Make WordPress Core

Changeset 27764


Ignore:
Timestamp:
03/27/2014 12:06:50 AM (11 years ago)
Author:
azaozz
Message:

Add the 'attachment_' prefix to caption IDs after editing, see #24409

File:
1 edited

Legend:

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

    r27758 r27764  
    187187
    188188    function updateImage( imageNode, imageData ) {
    189         var className, width, node, html, captionNode, nodeToReplace, uid, editedImg;
     189        var className, width, node, html, captionNode, nodeToReplace, uid, editedImg, id;
    190190
    191191        if ( imageData.caption ) {
     
    200200
    201201            className = 'align' + imageData.align;
    202 
    203             //TODO: shouldn't add the id attribute if it isn't an attachment
     202            id = imageData.attachment_id ? 'id="attachment_'+ imageData.attachment_id +'" ' : '';
    204203
    205204            // should create a new function for generating the caption markup
    206             html =  '<dl id="'+ imageData.attachment_id +'" class="wp-caption '+ className +'" style="width: '+ width +'px">' +
     205            html =  '<dl ' + id + 'class="wp-caption '+ className +'" style="width: '+ width +'px">' +
    207206                '<dt class="wp-caption-dt">'+ html + '</dt><dd class="wp-caption-dd">'+ imageData.caption +'</dd></dl>';
    208207
Note: See TracChangeset for help on using the changeset viewer.