Edit File by line
/home/barbar84/public_h.../wp-inclu.../js
File: media-editor.js
/**
[0] Fix | Delete
* @output wp-includes/js/media-editor.js
[1] Fix | Delete
*/
[2] Fix | Delete
[3] Fix | Delete
/* global getUserSetting, tinymce, QTags */
[4] Fix | Delete
[5] Fix | Delete
// WordPress, TinyMCE, and Media
[6] Fix | Delete
// -----------------------------
[7] Fix | Delete
(function($, _){
[8] Fix | Delete
/**
[9] Fix | Delete
* Stores the editors' `wp.media.controller.Frame` instances.
[10] Fix | Delete
*
[11] Fix | Delete
* @static
[12] Fix | Delete
*/
[13] Fix | Delete
var workflows = {};
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* A helper mixin function to avoid truthy and falsey values being
[17] Fix | Delete
* passed as an input that expects booleans. If key is undefined in the map,
[18] Fix | Delete
* but has a default value, set it.
[19] Fix | Delete
*
[20] Fix | Delete
* @param {Object} attrs Map of props from a shortcode or settings.
[21] Fix | Delete
* @param {string} key The key within the passed map to check for a value.
[22] Fix | Delete
* @return {mixed|undefined} The original or coerced value of key within attrs.
[23] Fix | Delete
*/
[24] Fix | Delete
wp.media.coerce = function ( attrs, key ) {
[25] Fix | Delete
if ( _.isUndefined( attrs[ key ] ) && ! _.isUndefined( this.defaults[ key ] ) ) {
[26] Fix | Delete
attrs[ key ] = this.defaults[ key ];
[27] Fix | Delete
} else if ( 'true' === attrs[ key ] ) {
[28] Fix | Delete
attrs[ key ] = true;
[29] Fix | Delete
} else if ( 'false' === attrs[ key ] ) {
[30] Fix | Delete
attrs[ key ] = false;
[31] Fix | Delete
}
[32] Fix | Delete
return attrs[ key ];
[33] Fix | Delete
};
[34] Fix | Delete
[35] Fix | Delete
/** @namespace wp.media.string */
[36] Fix | Delete
wp.media.string = {
[37] Fix | Delete
/**
[38] Fix | Delete
* Joins the `props` and `attachment` objects,
[39] Fix | Delete
* outputting the proper object format based on the
[40] Fix | Delete
* attachment's type.
[41] Fix | Delete
*
[42] Fix | Delete
* @param {Object} [props={}] Attachment details (align, link, size, etc).
[43] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[44] Fix | Delete
* @return {Object} Joined props
[45] Fix | Delete
*/
[46] Fix | Delete
props: function( props, attachment ) {
[47] Fix | Delete
var link, linkUrl, size, sizes,
[48] Fix | Delete
defaultProps = wp.media.view.settings.defaultProps;
[49] Fix | Delete
[50] Fix | Delete
props = props ? _.clone( props ) : {};
[51] Fix | Delete
[52] Fix | Delete
if ( attachment && attachment.type ) {
[53] Fix | Delete
props.type = attachment.type;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
if ( 'image' === props.type ) {
[57] Fix | Delete
props = _.defaults( props || {}, {
[58] Fix | Delete
align: defaultProps.align || getUserSetting( 'align', 'none' ),
[59] Fix | Delete
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
[60] Fix | Delete
url: '',
[61] Fix | Delete
classes: []
[62] Fix | Delete
});
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
// All attachment-specific settings follow.
[66] Fix | Delete
if ( ! attachment ) {
[67] Fix | Delete
return props;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
props.title = props.title || attachment.title;
[71] Fix | Delete
[72] Fix | Delete
link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
[73] Fix | Delete
if ( 'file' === link || 'embed' === link ) {
[74] Fix | Delete
linkUrl = attachment.url;
[75] Fix | Delete
} else if ( 'post' === link ) {
[76] Fix | Delete
linkUrl = attachment.link;
[77] Fix | Delete
} else if ( 'custom' === link ) {
[78] Fix | Delete
linkUrl = props.linkUrl;
[79] Fix | Delete
}
[80] Fix | Delete
props.linkUrl = linkUrl || '';
[81] Fix | Delete
[82] Fix | Delete
// Format properties for images.
[83] Fix | Delete
if ( 'image' === attachment.type ) {
[84] Fix | Delete
props.classes.push( 'wp-image-' + attachment.id );
[85] Fix | Delete
[86] Fix | Delete
sizes = attachment.sizes;
[87] Fix | Delete
size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment;
[88] Fix | Delete
[89] Fix | Delete
_.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), {
[90] Fix | Delete
width: size.width,
[91] Fix | Delete
height: size.height,
[92] Fix | Delete
src: size.url,
[93] Fix | Delete
captionId: 'attachment_' + attachment.id
[94] Fix | Delete
});
[95] Fix | Delete
} else if ( 'video' === attachment.type || 'audio' === attachment.type ) {
[96] Fix | Delete
_.extend( props, _.pick( attachment, 'title', 'type', 'icon', 'mime' ) );
[97] Fix | Delete
// Format properties for non-images.
[98] Fix | Delete
} else {
[99] Fix | Delete
props.title = props.title || attachment.filename;
[100] Fix | Delete
props.rel = props.rel || 'attachment wp-att-' + attachment.id;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
return props;
[104] Fix | Delete
},
[105] Fix | Delete
/**
[106] Fix | Delete
* Create link markup that is suitable for passing to the editor
[107] Fix | Delete
*
[108] Fix | Delete
* @param {Object} props Attachment details (align, link, size, etc).
[109] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[110] Fix | Delete
* @return {string} The link markup
[111] Fix | Delete
*/
[112] Fix | Delete
link: function( props, attachment ) {
[113] Fix | Delete
var options;
[114] Fix | Delete
[115] Fix | Delete
props = wp.media.string.props( props, attachment );
[116] Fix | Delete
[117] Fix | Delete
options = {
[118] Fix | Delete
tag: 'a',
[119] Fix | Delete
content: props.title,
[120] Fix | Delete
attrs: {
[121] Fix | Delete
href: props.linkUrl
[122] Fix | Delete
}
[123] Fix | Delete
};
[124] Fix | Delete
[125] Fix | Delete
if ( props.rel ) {
[126] Fix | Delete
options.attrs.rel = props.rel;
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
return wp.html.string( options );
[130] Fix | Delete
},
[131] Fix | Delete
/**
[132] Fix | Delete
* Create an Audio shortcode string that is suitable for passing to the editor
[133] Fix | Delete
*
[134] Fix | Delete
* @param {Object} props Attachment details (align, link, size, etc).
[135] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[136] Fix | Delete
* @return {string} The audio shortcode
[137] Fix | Delete
*/
[138] Fix | Delete
audio: function( props, attachment ) {
[139] Fix | Delete
return wp.media.string._audioVideo( 'audio', props, attachment );
[140] Fix | Delete
},
[141] Fix | Delete
/**
[142] Fix | Delete
* Create a Video shortcode string that is suitable for passing to the editor
[143] Fix | Delete
*
[144] Fix | Delete
* @param {Object} props Attachment details (align, link, size, etc).
[145] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[146] Fix | Delete
* @return {string} The video shortcode
[147] Fix | Delete
*/
[148] Fix | Delete
video: function( props, attachment ) {
[149] Fix | Delete
return wp.media.string._audioVideo( 'video', props, attachment );
[150] Fix | Delete
},
[151] Fix | Delete
/**
[152] Fix | Delete
* Helper function to create a media shortcode string
[153] Fix | Delete
*
[154] Fix | Delete
* @access private
[155] Fix | Delete
*
[156] Fix | Delete
* @param {string} type The shortcode tag name: 'audio' or 'video'.
[157] Fix | Delete
* @param {Object} props Attachment details (align, link, size, etc).
[158] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[159] Fix | Delete
* @return {string} The media shortcode
[160] Fix | Delete
*/
[161] Fix | Delete
_audioVideo: function( type, props, attachment ) {
[162] Fix | Delete
var shortcode, html, extension;
[163] Fix | Delete
[164] Fix | Delete
props = wp.media.string.props( props, attachment );
[165] Fix | Delete
if ( props.link !== 'embed' ) {
[166] Fix | Delete
return wp.media.string.link( props );
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
shortcode = {};
[170] Fix | Delete
[171] Fix | Delete
if ( 'video' === type ) {
[172] Fix | Delete
if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) {
[173] Fix | Delete
shortcode.poster = attachment.image.src;
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
if ( attachment.width ) {
[177] Fix | Delete
shortcode.width = attachment.width;
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
if ( attachment.height ) {
[181] Fix | Delete
shortcode.height = attachment.height;
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
extension = attachment.filename.split('.').pop();
[186] Fix | Delete
[187] Fix | Delete
if ( _.contains( wp.media.view.settings.embedExts, extension ) ) {
[188] Fix | Delete
shortcode[extension] = attachment.url;
[189] Fix | Delete
} else {
[190] Fix | Delete
// Render unsupported audio and video files as links.
[191] Fix | Delete
return wp.media.string.link( props );
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
html = wp.shortcode.string({
[195] Fix | Delete
tag: type,
[196] Fix | Delete
attrs: shortcode
[197] Fix | Delete
});
[198] Fix | Delete
[199] Fix | Delete
return html;
[200] Fix | Delete
},
[201] Fix | Delete
/**
[202] Fix | Delete
* Create image markup, optionally with a link and/or wrapped in a caption shortcode,
[203] Fix | Delete
* that is suitable for passing to the editor
[204] Fix | Delete
*
[205] Fix | Delete
* @param {Object} props Attachment details (align, link, size, etc).
[206] Fix | Delete
* @param {Object} attachment The attachment object, media version of Post.
[207] Fix | Delete
* @return {string}
[208] Fix | Delete
*/
[209] Fix | Delete
image: function( props, attachment ) {
[210] Fix | Delete
var img = {},
[211] Fix | Delete
options, classes, shortcode, html;
[212] Fix | Delete
[213] Fix | Delete
props.type = 'image';
[214] Fix | Delete
props = wp.media.string.props( props, attachment );
[215] Fix | Delete
classes = props.classes || [];
[216] Fix | Delete
[217] Fix | Delete
img.src = ! _.isUndefined( attachment ) ? attachment.url : props.url;
[218] Fix | Delete
_.extend( img, _.pick( props, 'width', 'height', 'alt' ) );
[219] Fix | Delete
[220] Fix | Delete
// Only assign the align class to the image if we're not printing
[221] Fix | Delete
// a caption, since the alignment is sent to the shortcode.
[222] Fix | Delete
if ( props.align && ! props.caption ) {
[223] Fix | Delete
classes.push( 'align' + props.align );
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
if ( props.size ) {
[227] Fix | Delete
classes.push( 'size-' + props.size );
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
img['class'] = _.compact( classes ).join(' ');
[231] Fix | Delete
[232] Fix | Delete
// Generate `img` tag options.
[233] Fix | Delete
options = {
[234] Fix | Delete
tag: 'img',
[235] Fix | Delete
attrs: img,
[236] Fix | Delete
single: true
[237] Fix | Delete
};
[238] Fix | Delete
[239] Fix | Delete
// Generate the `a` element options, if they exist.
[240] Fix | Delete
if ( props.linkUrl ) {
[241] Fix | Delete
options = {
[242] Fix | Delete
tag: 'a',
[243] Fix | Delete
attrs: {
[244] Fix | Delete
href: props.linkUrl
[245] Fix | Delete
},
[246] Fix | Delete
content: options
[247] Fix | Delete
};
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
html = wp.html.string( options );
[251] Fix | Delete
[252] Fix | Delete
// Generate the caption shortcode.
[253] Fix | Delete
if ( props.caption ) {
[254] Fix | Delete
shortcode = {};
[255] Fix | Delete
[256] Fix | Delete
if ( img.width ) {
[257] Fix | Delete
shortcode.width = img.width;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
if ( props.captionId ) {
[261] Fix | Delete
shortcode.id = props.captionId;
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
if ( props.align ) {
[265] Fix | Delete
shortcode.align = 'align' + props.align;
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
html = wp.shortcode.string({
[269] Fix | Delete
tag: 'caption',
[270] Fix | Delete
attrs: shortcode,
[271] Fix | Delete
content: html + ' ' + props.caption
[272] Fix | Delete
});
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
return html;
[276] Fix | Delete
}
[277] Fix | Delete
};
[278] Fix | Delete
[279] Fix | Delete
wp.media.embed = {
[280] Fix | Delete
coerce : wp.media.coerce,
[281] Fix | Delete
[282] Fix | Delete
defaults : {
[283] Fix | Delete
url : '',
[284] Fix | Delete
width: '',
[285] Fix | Delete
height: ''
[286] Fix | Delete
},
[287] Fix | Delete
[288] Fix | Delete
edit : function( data, isURL ) {
[289] Fix | Delete
var frame, props = {}, shortcode;
[290] Fix | Delete
[291] Fix | Delete
if ( isURL ) {
[292] Fix | Delete
props.url = data.replace(/<[^>]+>/g, '');
[293] Fix | Delete
} else {
[294] Fix | Delete
shortcode = wp.shortcode.next( 'embed', data ).shortcode;
[295] Fix | Delete
[296] Fix | Delete
props = _.defaults( shortcode.attrs.named, this.defaults );
[297] Fix | Delete
if ( shortcode.content ) {
[298] Fix | Delete
props.url = shortcode.content;
[299] Fix | Delete
}
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
frame = wp.media({
[303] Fix | Delete
frame: 'post',
[304] Fix | Delete
state: 'embed',
[305] Fix | Delete
metadata: props
[306] Fix | Delete
});
[307] Fix | Delete
[308] Fix | Delete
return frame;
[309] Fix | Delete
},
[310] Fix | Delete
[311] Fix | Delete
shortcode : function( model ) {
[312] Fix | Delete
var self = this, content;
[313] Fix | Delete
[314] Fix | Delete
_.each( this.defaults, function( value, key ) {
[315] Fix | Delete
model[ key ] = self.coerce( model, key );
[316] Fix | Delete
[317] Fix | Delete
if ( value === model[ key ] ) {
[318] Fix | Delete
delete model[ key ];
[319] Fix | Delete
}
[320] Fix | Delete
});
[321] Fix | Delete
[322] Fix | Delete
content = model.url;
[323] Fix | Delete
delete model.url;
[324] Fix | Delete
[325] Fix | Delete
return new wp.shortcode({
[326] Fix | Delete
tag: 'embed',
[327] Fix | Delete
attrs: model,
[328] Fix | Delete
content: content
[329] Fix | Delete
});
[330] Fix | Delete
}
[331] Fix | Delete
};
[332] Fix | Delete
[333] Fix | Delete
/**
[334] Fix | Delete
* @class wp.media.collection
[335] Fix | Delete
*
[336] Fix | Delete
* @param {Object} attributes
[337] Fix | Delete
*/
[338] Fix | Delete
wp.media.collection = function(attributes) {
[339] Fix | Delete
var collections = {};
[340] Fix | Delete
[341] Fix | Delete
return _.extend(/** @lends wp.media.collection.prototype */{
[342] Fix | Delete
coerce : wp.media.coerce,
[343] Fix | Delete
/**
[344] Fix | Delete
* Retrieve attachments based on the properties of the passed shortcode
[345] Fix | Delete
*
[346] Fix | Delete
* @param {wp.shortcode} shortcode An instance of wp.shortcode().
[347] Fix | Delete
* @return {wp.media.model.Attachments} A Backbone.Collection containing
[348] Fix | Delete
* the media items belonging to a collection.
[349] Fix | Delete
* The query[ this.tag ] property is a Backbone.Model
[350] Fix | Delete
* containing the 'props' for the collection.
[351] Fix | Delete
*/
[352] Fix | Delete
attachments: function( shortcode ) {
[353] Fix | Delete
var shortcodeString = shortcode.string(),
[354] Fix | Delete
result = collections[ shortcodeString ],
[355] Fix | Delete
attrs, args, query, others, self = this;
[356] Fix | Delete
[357] Fix | Delete
delete collections[ shortcodeString ];
[358] Fix | Delete
if ( result ) {
[359] Fix | Delete
return result;
[360] Fix | Delete
}
[361] Fix | Delete
// Fill the default shortcode attributes.
[362] Fix | Delete
attrs = _.defaults( shortcode.attrs.named, this.defaults );
[363] Fix | Delete
args = _.pick( attrs, 'orderby', 'order' );
[364] Fix | Delete
[365] Fix | Delete
args.type = this.type;
[366] Fix | Delete
args.perPage = -1;
[367] Fix | Delete
[368] Fix | Delete
// Mark the `orderby` override attribute.
[369] Fix | Delete
if ( undefined !== attrs.orderby ) {
[370] Fix | Delete
attrs._orderByField = attrs.orderby;
[371] Fix | Delete
}
[372] Fix | Delete
[373] Fix | Delete
if ( 'rand' === attrs.orderby ) {
[374] Fix | Delete
attrs._orderbyRandom = true;
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
// Map the `orderby` attribute to the corresponding model property.
[378] Fix | Delete
if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) {
[379] Fix | Delete
args.orderby = 'menuOrder';
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
// Map the `ids` param to the correct query args.
[383] Fix | Delete
if ( attrs.ids ) {
[384] Fix | Delete
args.post__in = attrs.ids.split(',');
[385] Fix | Delete
args.orderby = 'post__in';
[386] Fix | Delete
} else if ( attrs.include ) {
[387] Fix | Delete
args.post__in = attrs.include.split(',');
[388] Fix | Delete
}
[389] Fix | Delete
[390] Fix | Delete
if ( attrs.exclude ) {
[391] Fix | Delete
args.post__not_in = attrs.exclude.split(',');
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
if ( ! args.post__in ) {
[395] Fix | Delete
args.uploadedTo = attrs.id;
[396] Fix | Delete
}
[397] Fix | Delete
[398] Fix | Delete
// Collect the attributes that were not included in `args`.
[399] Fix | Delete
others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' );
[400] Fix | Delete
[401] Fix | Delete
_.each( this.defaults, function( value, key ) {
[402] Fix | Delete
others[ key ] = self.coerce( others, key );
[403] Fix | Delete
});
[404] Fix | Delete
[405] Fix | Delete
query = wp.media.query( args );
[406] Fix | Delete
query[ this.tag ] = new Backbone.Model( others );
[407] Fix | Delete
return query;
[408] Fix | Delete
},
[409] Fix | Delete
/**
[410] Fix | Delete
* Triggered when clicking 'Insert {label}' or 'Update {label}'
[411] Fix | Delete
*
[412] Fix | Delete
* @param {wp.media.model.Attachments} attachments A Backbone.Collection containing
[413] Fix | Delete
* the media items belonging to a collection.
[414] Fix | Delete
* The query[ this.tag ] property is a Backbone.Model
[415] Fix | Delete
* containing the 'props' for the collection.
[416] Fix | Delete
* @return {wp.shortcode}
[417] Fix | Delete
*/
[418] Fix | Delete
shortcode: function( attachments ) {
[419] Fix | Delete
var props = attachments.props.toJSON(),
[420] Fix | Delete
attrs = _.pick( props, 'orderby', 'order' ),
[421] Fix | Delete
shortcode, clone;
[422] Fix | Delete
[423] Fix | Delete
if ( attachments.type ) {
[424] Fix | Delete
attrs.type = attachments.type;
[425] Fix | Delete
delete attachments.type;
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
if ( attachments[this.tag] ) {
[429] Fix | Delete
_.extend( attrs, attachments[this.tag].toJSON() );
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
/*
[433] Fix | Delete
* Convert all gallery shortcodes to use the `ids` property.
[434] Fix | Delete
* Ignore `post__in` and `post__not_in`; the attachments in
[435] Fix | Delete
* the collection will already reflect those properties.
[436] Fix | Delete
*/
[437] Fix | Delete
attrs.ids = attachments.pluck('id');
[438] Fix | Delete
[439] Fix | Delete
// Copy the `uploadedTo` post ID.
[440] Fix | Delete
if ( props.uploadedTo ) {
[441] Fix | Delete
attrs.id = props.uploadedTo;
[442] Fix | Delete
}
[443] Fix | Delete
// Check if the gallery is randomly ordered.
[444] Fix | Delete
delete attrs.orderby;
[445] Fix | Delete
[446] Fix | Delete
if ( attrs._orderbyRandom ) {
[447] Fix | Delete
attrs.orderby = 'rand';
[448] Fix | Delete
} else if ( attrs._orderByField && 'rand' !== attrs._orderByField ) {
[449] Fix | Delete
attrs.orderby = attrs._orderByField;
[450] Fix | Delete
}
[451] Fix | Delete
[452] Fix | Delete
delete attrs._orderbyRandom;
[453] Fix | Delete
delete attrs._orderByField;
[454] Fix | Delete
[455] Fix | Delete
// If the `ids` attribute is set and `orderby` attribute
[456] Fix | Delete
// is the default value, clear it for cleaner output.
[457] Fix | Delete
if ( attrs.ids && 'post__in' === attrs.orderby ) {
[458] Fix | Delete
delete attrs.orderby;
[459] Fix | Delete
}
[460] Fix | Delete
[461] Fix | Delete
attrs = this.setDefaults( attrs );
[462] Fix | Delete
[463] Fix | Delete
shortcode = new wp.shortcode({
[464] Fix | Delete
tag: this.tag,
[465] Fix | Delete
attrs: attrs,
[466] Fix | Delete
type: 'single'
[467] Fix | Delete
});
[468] Fix | Delete
[469] Fix | Delete
// Use a cloned version of the gallery.
[470] Fix | Delete
clone = new wp.media.model.Attachments( attachments.models, {
[471] Fix | Delete
props: props
[472] Fix | Delete
});
[473] Fix | Delete
clone[ this.tag ] = attachments[ this.tag ];
[474] Fix | Delete
collections[ shortcode.string() ] = clone;
[475] Fix | Delete
[476] Fix | Delete
return shortcode;
[477] Fix | Delete
},
[478] Fix | Delete
/**
[479] Fix | Delete
* Triggered when double-clicking a collection shortcode placeholder
[480] Fix | Delete
* in the editor
[481] Fix | Delete
*
[482] Fix | Delete
* @param {string} content Content that is searched for possible
[483] Fix | Delete
* shortcode markup matching the passed tag name,
[484] Fix | Delete
*
[485] Fix | Delete
* @this wp.media.{prop}
[486] Fix | Delete
*
[487] Fix | Delete
* @return {wp.media.view.MediaFrame.Select} A media workflow.
[488] Fix | Delete
*/
[489] Fix | Delete
edit: function( content ) {
[490] Fix | Delete
var shortcode = wp.shortcode.next( this.tag, content ),
[491] Fix | Delete
defaultPostId = this.defaults.id,
[492] Fix | Delete
attachments, selection, state;
[493] Fix | Delete
[494] Fix | Delete
// Bail if we didn't match the shortcode or all of the content.
[495] Fix | Delete
if ( ! shortcode || shortcode.content !== content ) {
[496] Fix | Delete
return;
[497] Fix | Delete
}
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function