Don't show edit/remove image buttons in the visual editor when an image is floated, doesn't have a caption and there is text in the same paragraph, props solarissmoke, fixes #19611

git-svn-id: http://svn.automattic.com/wordpress/trunk@19984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2012-02-24 19:18:59 +00:00
parent a24bfc4d47
commit 77133d2c96

View File

@ -69,17 +69,24 @@
// show editimage buttons
ed.onMouseDown.add(function(ed, e) {
var target = e.target;
if ( e.target && ( e.target.nodeName == 'IMG' || (e.target.firstChild && e.target.firstChild.nodeName == 'IMG') ) ) {
if ( target.nodeName != 'IMG' ) {
if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 )
target = target.firstChild;
else
return;
}
if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) {
mouse = {
x: e.clientX,
y: e.clientY,
img_w: e.target.clientWidth,
img_h: e.target.clientHeight
img_w: target.clientWidth,
img_h: target.clientHeight
};
if ( ed.dom.getAttrib(e.target, 'class').indexOf('mceItem') == -1 )
ed.plugins.wordpress._showButtons(e.target, 'wp_editbtns');
ed.plugins.wordpress._showButtons(target, 'wp_editbtns');
}
});