Ticket #28003: 28003.3.patch
| File 28003.3.patch, 1.6 KB (added by , 11 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 if ( ! editor.dom.getParent( rng.startContainer, '.mceTemp' ) ) { 976 editor.undoManager.transact( function() { 977 editor.selection.setRng( rng ); 978 editor.selection.setNode( wrap ); 979 editor.dom.remove( wrap ); 980 } ); 981 } 982 } 983 984 wrap = null; 985 } ); 986 } )(); 987 967 988 // Add to editor.wp 968 989 editor.wp = editor.wp || {}; 969 990 editor.wp.isPlaceholder = isPlaceholder;