diff --git src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
index d8b735f..af655ae 100644
|
|
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
808 | 808 | editor.undoManager.add(); |
809 | 809 | } |
810 | 810 | |
| 811 | function selectImageParent( event ) { |
| 812 | var node = editor.selection.getNode(), |
| 813 | parent = node.parentNode; |
| 814 | |
| 815 | if ( node.nodeName === 'IMG' ) { |
| 816 | |
| 817 | // Prevent dragging images out of the caption elements |
| 818 | if ( event.type == 'dragstart' && editor.dom.getParent( node, '.wp-caption' ) ) { |
| 819 | event.preventDefault(); |
| 820 | } |
| 821 | |
| 822 | // Select anchor nodes without text content |
| 823 | if ( parent && parent.nodeName === 'A' && ! hasTextContent( parent ) ) { |
| 824 | editor.selection.select( parent ); |
| 825 | } |
| 826 | |
| 827 | // Select anchor nodes without text content, which wrap an inner node like strong or em |
| 828 | if ( parent && parent.nodeName !== 'A' && parent.parentNode && parent.parentNode.nodeName === 'A' && ! hasTextContent( parent.parentNode ) ) { |
| 829 | editor.selection.select( parent.parentNode ); |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | |
811 | 834 | editor.on( 'init', function() { |
812 | 835 | var dom = editor.dom, |
813 | 836 | captionClass = editor.getParam( 'wpeditimage_html5_captions' ) ? 'html5-captions' : 'html4-captions'; |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
1038 | 1061 | } |
1039 | 1062 | }); |
1040 | 1063 | |
1041 | | dom.bind( editor.getDoc(), 'dragstart', function( event ) { |
1042 | | var node = editor.selection.getNode(); |
1043 | | |
1044 | | // Prevent dragging images out of the caption elements |
1045 | | if ( node.nodeName === 'IMG' && dom.getParent( node, '.wp-caption' ) ) { |
1046 | | event.preventDefault(); |
1047 | | } |
1048 | | }); |
1049 | | |
1050 | 1064 | // Prevent IE11 from making dl.wp-caption resizable |
1051 | 1065 | if ( tinymce.Env.ie && tinymce.Env.ie > 10 ) { |
1052 | 1066 | // The 'mscontrolselect' event is supported only in IE11+ |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
1220 | 1234 | } |
1221 | 1235 | }); |
1222 | 1236 | |
| 1237 | editor.on( 'dragstart', function( event ) { |
| 1238 | selectImageParent( event ); |
| 1239 | }); |
| 1240 | |
| 1241 | editor.on( 'contextmenu', function( event ) { |
| 1242 | selectImageParent( event ); |
| 1243 | }); |
| 1244 | |
| 1245 | editor.on( 'keydown', function( event ) { |
| 1246 | if ( tinymce.util.VK.metaKeyPressed( event ) ) { |
| 1247 | selectImageParent( event ); |
| 1248 | } |
| 1249 | }); |
| 1250 | |
1223 | 1251 | return { |
1224 | 1252 | _do_shcode: parseShortcode, |
1225 | 1253 | _get_shcode: getShortcode |