WordPress.org

Make WordPress Core

Changeset 38328


Ignore:
Timestamp:
08/23/2016 04:42:58 AM (3 years ago)
Author:
azaozz
Message:

TinyMCE: make sure the temporary id is removed when using the default image dialog and inserting an external image.

Props fomenkoandrey for reporting and testing.
Fixes #37467.

File:
1 edited

Legend:

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

    r38156 r38328  
    631631                captionAlign = '',
    632632                captionWidth = '',
    633                 wrap, parent, node, html, imgId;
     633                imgId = null,
     634                wrap, parent, node, html;
    634635
    635636            // Temp image id so we can find the node later
     
    797798
    798799            imgNode = dom.get('__wp-temp-img-id');
    799             dom.setAttrib( imgNode, 'id', imgId );
     800            dom.setAttrib( imgNode, 'id', imgId || null );
    800801            event.imgData.node = imgNode;
    801802        });
     
    977978    };
    978979
     980    editor.on( 'beforeGetContent', function( event ) {
     981        if ( event.format !== 'raw' ) {
     982            editor.$( 'img[id="__wp-temp-img-id"]' ).attr( 'id', null );
     983        }   
     984    });
     985
    979986    editor.on( 'BeforeSetContent', function( event ) {
    980987        if ( event.format !== 'raw' ) {
Note: See TracChangeset for help on using the changeset viewer.