WordPress.org

Make WordPress Core

Changeset 27098


Ignore:
Timestamp:
02/05/2014 02:06:10 AM (7 years ago)
Author:
azaozz
Message:

TinyMCE: set the proper caption width when clicking image resize handle on image with caption. Props gcorne, fixes #27009, see #24067.

File:
1 edited

Legend:

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

    r27051 r27098  
    496496
    497497    editor.on( 'ObjectResized', function( event ) {
    498         var parent,
     498        var parent, width,
    499499            node = event.target;
    500500
    501501        if ( node.nodeName === 'IMG' && ( parent = editor.dom.getParent( node, '.wp-caption' ) ) ) {
    502             editor.dom.setStyle( parent, 'width', 10 + event.width + 'px' );
     502            width = event.width || editor.dom.getAttrib( node, 'width' );
     503
     504            if ( width ) {
     505                width = parseInt( width, 10 ) + 10;
     506                editor.dom.setStyle( parent, 'width', width + 'px' );
     507            }
    503508        }
    504509    });
Note: See TracChangeset for help on using the changeset viewer.