Add a canonical location for media frames, an alias to fetch attachments, and frame caching to custom header. fixes #22775.
git-svn-id: http://core.svn.wordpress.org/trunk@23092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c4ef3fe74c
commit
30440dbb66
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media({
|
||||
frame = wp.media.frames.customBackground = wp.media({
|
||||
// Set the title of the modal.
|
||||
title: $el.data('choose'),
|
||||
|
||||
|
|
|
@ -18,8 +18,14 @@
|
|||
var $el = $(this);
|
||||
event.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if ( frame ) {
|
||||
frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media({
|
||||
frame = wp.media.frames.customHeader = wp.media({
|
||||
// Set the title of the modal.
|
||||
title: $el.data('choose'),
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ window.wp = window.wp || {};
|
|||
return frame;
|
||||
};
|
||||
|
||||
_.extend( media, { model: {}, view: {}, controller: {} });
|
||||
_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
|
||||
|
||||
// Link any localized strings.
|
||||
l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
|
||||
|
@ -216,6 +216,13 @@ window.wp = window.wp || {};
|
|||
* ========================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* wp.media.attachment
|
||||
*/
|
||||
media.attachment = function( id ) {
|
||||
return Attachment.get( id );
|
||||
};
|
||||
|
||||
/**
|
||||
* wp.media.model.Attachment
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue