Make WordPress Core

Changeset 19984


Ignore:
Timestamp:
02/24/2012 07:18:59 PM (13 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js

    r19982 r19984  
    7070            // show editimage buttons
    7171            ed.onMouseDown.add(function(ed, e) {
    72 
    73                 if ( e.target && ( e.target.nodeName == 'IMG' || (e.target.firstChild && e.target.firstChild.nodeName == 'IMG') ) ) {
     72                var target = e.target;
     73
     74                if ( target.nodeName != 'IMG' ) {
     75                    if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 )
     76                        target = target.firstChild;
     77                    else
     78                        return;
     79                }
     80
     81                if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) {
    7482                    mouse = {
    7583                        x: e.clientX,
    7684                        y: e.clientY,
    77                         img_w: e.target.clientWidth,
    78                         img_h: e.target.clientHeight
     85                        img_w: target.clientWidth,
     86                        img_h: target.clientHeight
    7987                    };
    8088
    81                     if ( ed.dom.getAttrib(e.target, 'class').indexOf('mceItem') == -1 )
    82                         ed.plugins.wordpress._showButtons(e.target, 'wp_editbtns');
     89                    ed.plugins.wordpress._showButtons(target, 'wp_editbtns');
    8390                }
    8491            });
Note: See TracChangeset for help on using the changeset viewer.