TinyMCE: don't show image toolbar for placeholder images. See #30147.

Built from https://develop.svn.wordpress.org/trunk@30361


git-svn-id: http://core.svn.wordpress.org/trunk@30360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-11-16 23:12:22 +00:00
parent 7cdbac53e8
commit 22b760088c
3 changed files with 7 additions and 3 deletions

View File

@ -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 {

File diff suppressed because one or more lines are too long