TinyMCE: when dragging, prevent error when a range cannot be created at the drop location.

Fixes #36229.

git-svn-id: https://develop.svn.wordpress.org/trunk@36983 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2016-03-13 22:55:01 +00:00
parent 4fcb429575
commit 8f8b1001ad
1 changed files with 5 additions and 2 deletions

View File

@ -1005,13 +1005,16 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
rng = tinymce.dom.RangeUtils.getCaretRangeFromPoint( event.clientX, event.clientY, editor.getDoc() );
// Don't allow anything to be dropped in a captioned image.
if ( dom.getParent( rng.startContainer, '.mceTemp' ) ) {
if ( rng && dom.getParent( rng.startContainer, '.mceTemp' ) ) {
event.preventDefault();
} else if ( wrap ) {
event.preventDefault();
editor.undoManager.transact( function() {
editor.selection.setRng( rng );
if ( rng ) {
editor.selection.setRng( rng );
}
editor.selection.setNode( wrap );
dom.remove( wrap );
} );