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

Fixes #36229.
Built from https://develop.svn.wordpress.org/trunk@36983


git-svn-id: http://core.svn.wordpress.org/trunk@36950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-03-13 22:55:25 +00:00
parent c495d3b2b3
commit 8fda4ca0b2
4 changed files with 7 additions and 4 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-beta3-36982'; $wp_version = '4.5-beta3-36983';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.