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