diff --git src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
index 3ba19b4..63afb3a 100644
|
|
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
102 | 102 | }); |
103 | 103 | |
104 | 104 | if ( out.indexOf('[caption') !== 0 ) { |
105 | | // the caption html seems brocken, try to find the image that may be wrapped in a link |
| 105 | // the caption html seems broken, try to find the image that may be wrapped in a link |
106 | 106 | // and may be followed by <p> with the caption text. |
107 | 107 | out = b.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' ); |
108 | 108 | } |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
339 | 339 | } else { |
340 | 340 | editor.dom.remove( node ); |
341 | 341 | } |
| 342 | removeToolbar(); |
342 | 343 | } |
343 | 344 | |
344 | 345 | function addToolbar( node ) { |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
755 | 756 | selection = editor.selection, |
756 | 757 | dom = editor.dom; |
757 | 758 | |
| 759 | node = selection.getNode(); |
| 760 | |
758 | 761 | if ( event.keyCode === tinymce.util.VK.ENTER ) { |
759 | 762 | // When pressing Enter inside a caption move the caret to a new parapraph under it |
760 | | node = selection.getNode(); |
761 | 763 | wrap = dom.getParent( node, 'div.mceTemp' ); |
762 | 764 | |
763 | 765 | if ( wrap ) { |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
783 | 785 | selection.setCursorLocation( P, 0 ); |
784 | 786 | } |
785 | 787 | } else if ( event.keyCode === tinymce.util.VK.DELETE || event.keyCode === tinymce.util.VK.BACKSPACE ) { |
786 | | node = selection.getNode(); |
787 | 788 | |
788 | 789 | if ( node.nodeName === 'DIV' && dom.hasClass( node, 'mceTemp' ) ) { |
789 | 790 | wrap = node; |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
797 | 798 | return false; |
798 | 799 | } |
799 | 800 | } |
| 801 | |
| 802 | // Key presses will replace the image so we need to remove the toolbar |
| 803 | if ( dom.getAttrib( node, 'data-wp-imgselect' ) ) { |
| 804 | removeToolbar(); |
| 805 | } |
800 | 806 | }); |
801 | 807 | |
802 | 808 | editor.on( 'mousedown', function( event ) { |
… |
… |
tinymce.PluginManager.add( 'wpeditimage', function( editor ) { |
828 | 834 | |
829 | 835 | if ( dom.hasClass( node, 'remove' ) ) { |
830 | 836 | removeImage( image ); |
831 | | removeToolbar(); |
832 | 837 | } else if ( dom.hasClass( node, 'edit' ) ) { |
833 | 838 | editImage( image ); |
834 | 839 | } |