From 5e5caca1137dfd2792f78d18ed9f53a75a2879ea Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 7 Mar 2014 06:33:06 +0000 Subject: [PATCH] TinyMCE editimage: show the toolbar on `mouseup` to avoid accidental clicks on the buttons, fixes #24409 git-svn-id: https://develop.svn.wordpress.org/trunk@27451 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wpeditimage/plugin.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index be6d55529e..0c48ee54f8 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -774,15 +774,13 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { }); editor.on( 'mousedown', function( event ) { - var node = event.target; - - if ( tinymce.Env.ie && editor.dom.getParent( node, '#wp-image-toolbar' ) ) { - // Stop IE > 8 from making the wrapper resizable on mousedown - event.preventDefault(); - } - - if ( node.nodeName === 'IMG' && ! editor.dom.getAttrib( node, 'data-wp-imgselect' ) && ! isPlaceholder( node ) ) { - addToolbar( node ); + if ( editor.dom.getParent( event.target, '#wp-image-toolbar' ) ) { + if ( tinymce.Env.ie ) { + // Stop IE > 8 from making the wrapper resizable on mousedown + event.preventDefault(); + } + } else if ( event.target.nodeName !== 'IMG' ) { + removeToolbar(); } }); @@ -809,6 +807,8 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { editImage( image ); } } + } else if ( node.nodeName === 'IMG' && ! editor.dom.getAttrib( node, 'data-wp-imgselect' ) && ! isPlaceholder( node ) ) { + addToolbar( node ); } else if ( node.nodeName !== 'IMG' ) { removeToolbar(); }