Ticket #28003: 28003.2.patch
File 28003.2.patch, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
782 782 } 783 783 }); 784 784 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 785 // Prevent IE11 from making dl.wp-caption resizable 795 786 if ( tinymce.Env.ie && tinymce.Env.ie > 10 ) { 796 787 // The 'mscontrolselect' event is supported only in IE11+ … … 964 955 } 965 956 }); 966 957 958 ( function() { 959 var wrap; 960 961 editor.on( 'dragstart', function() { 962 var node = editor.selection.getNode(); 963 964 if ( node.nodeName === 'IMG' ) { 965 wrap = editor.dom.getParent( node, '.mceTemp' ); 966 } 967 } ); 968 969 editor.on( 'drop', function( event ) { 970 var rng; 971 972 if ( wrap && ( rng = tinymce.dom.RangeUtils.getCaretRangeFromPoint( event.clientX, event.clientY, editor.getDoc() ) ) ) { 973 event.preventDefault(); 974 975 editor.undoManager.transact( function() { 976 editor.selection.setRng( rng ); 977 editor.selection.setNode( wrap ); 978 editor.dom.remove( wrap ); 979 } ); 980 } 981 982 wrap = null; 983 } ); 984 } )(); 985 967 986 // Add to editor.wp 968 987 editor.wp = editor.wp || {}; 969 988 editor.wp.isPlaceholder = isPlaceholder;