Ticket #28003: 28003.patch
| File 28003.patch, 1.8 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
3 3 var toolbar, serializer, 4 4 each = tinymce.each, 5 5 trim = tinymce.trim, 6 iOS = tinymce.Env.iOS; 6 iOS = tinymce.Env.iOS, 7 $ = tinymce.$; 7 8 8 9 function isPlaceholder( node ) { 9 10 return !! ( editor.dom.getAttrib( node, 'data-mce-placeholder' ) || editor.dom.getAttrib( node, 'data-mce-object' ) ); … … 782 783 } 783 784 }); 784 785 785 dom.bind( editor.getDoc(), 'dragstart', function( event ) {786 var node = editor.selection.getNode();787 788 // Prevent dragging images out of the caption elements789 if ( node.nodeName === 'IMG' && dom.getParent( node, '.wp-caption' ) ) {790 event.preventDefault();791 }792 });793 794 786 // Prevent IE11 from making dl.wp-caption resizable 795 787 if ( tinymce.Env.ie && tinymce.Env.ie > 10 ) { 796 788 // The 'mscontrolselect' event is supported only in IE11+ … … 964 956 } 965 957 }); 966 958 959 ( function() { 960 var wrap; 961 962 editor.on( 'dragstart', function() { 963 var node = editor.selection.getNode(); 964 965 if ( node.nodeName === 'IMG' ) { 966 wrap = editor.dom.getParent( node, '.mceTemp' ); 967 } 968 } ); 969 970 editor.on( 'drop', function( event ) { 971 var rng; 972 973 if ( wrap && ( rng = tinymce.dom.RangeUtils.getCaretRangeFromPoint( event.clientX, event.clientY, editor.getDoc() ) ) ) { 974 event.preventDefault(); 975 976 editor.undoManager.transact( function() { 977 editor.selection.setRng( rng ); 978 editor.selection.setNode( wrap ); 979 editor.dom.remove( wrap ); 980 } ); 981 } 982 983 wrap = null; 984 } ); 985 } )(); 986 967 987 // Add to editor.wp 968 988 editor.wp = editor.wp || {}; 969 989 editor.wp.isPlaceholder = isPlaceholder;