From d2b8163078c348ddfd6fe526ca0681801f074699 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 16 Nov 2014 23:11:14 +0000 Subject: [PATCH] TinyMCE: don't show image toolbar for placeholder images. See #30147. git-svn-id: https://develop.svn.wordpress.org/trunk@30361 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 84bfccae65..b46c989061 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -9,6 +9,10 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { editorWrapParent = tinymce.$( '#postdivrich' ), tb; + function isPlaceholder( node ) { + return !! ( editor.dom.getAttrib( node, 'data-mce-placeholder' ) || editor.dom.getAttrib( node, 'data-mce-object' ) ); + } + editor.addButton( 'wp_img_remove', { tooltip: 'Remove', icon: 'dashicon dashicons-no', @@ -267,7 +271,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { editor.on( 'nodechange', function( event ) { var delay = iOS ? 350 : 100; - if ( event.element.nodeName !== 'IMG' ) { + if ( event.element.nodeName !== 'IMG' || isPlaceholder( event.element.nodeName ) ) { tb.hide(); return; } @@ -275,7 +279,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { setTimeout( function() { var element = editor.selection.getNode(); - if ( element.nodeName === 'IMG' ) { + if ( element.nodeName === 'IMG' && ! isPlaceholder( element ) ) { if ( tb._visible ) { tb.reposition(); } else {