mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
TinyMCE: make captioned images draggable
See #28003. Built from https://develop.svn.wordpress.org/trunk@35199 git-svn-id: http://core.svn.wordpress.org/trunk@35165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3babb1682a
commit
3eb4a57c27
@ -782,15 +782,6 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
}
|
||||
});
|
||||
|
||||
dom.bind( editor.getDoc(), 'dragstart', function( event ) {
|
||||
var node = editor.selection.getNode();
|
||||
|
||||
// Prevent dragging images out of the caption elements
|
||||
if ( node.nodeName === 'IMG' && dom.getParent( node, '.wp-caption' ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent IE11 from making dl.wp-caption resizable
|
||||
if ( tinymce.Env.ie && tinymce.Env.ie > 10 ) {
|
||||
// The 'mscontrolselect' event is supported only in IE11+
|
||||
@ -964,6 +955,36 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
}
|
||||
});
|
||||
|
||||
( function() {
|
||||
var wrap;
|
||||
|
||||
editor.on( 'dragstart', function() {
|
||||
var node = editor.selection.getNode();
|
||||
|
||||
if ( node.nodeName === 'IMG' ) {
|
||||
wrap = editor.dom.getParent( node, '.mceTemp' );
|
||||
}
|
||||
} );
|
||||
|
||||
editor.on( 'drop', function( event ) {
|
||||
var rng;
|
||||
|
||||
if ( wrap && ( rng = tinymce.dom.RangeUtils.getCaretRangeFromPoint( event.clientX, event.clientY, editor.getDoc() ) ) ) {
|
||||
event.preventDefault();
|
||||
|
||||
if ( ! editor.dom.getParent( rng.startContainer, '.mceTemp' ) ) {
|
||||
editor.undoManager.transact( function() {
|
||||
editor.selection.setRng( rng );
|
||||
editor.selection.setNode( wrap );
|
||||
editor.dom.remove( wrap );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
wrap = null;
|
||||
} );
|
||||
} )();
|
||||
|
||||
// Add to editor.wp
|
||||
editor.wp = editor.wp || {};
|
||||
editor.wp.isPlaceholder = isPlaceholder;
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-35198';
|
||||
$wp_version = '4.4-alpha-35199';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user