Edit File by line
/home/barbar84/public_h.../wp-inclu.../js
File: media-views.js
/******/ (function(modules) { // webpackBootstrap
[0] Fix | Delete
/******/ // The module cache
[1] Fix | Delete
/******/ var installedModules = {};
[2] Fix | Delete
/******/
[3] Fix | Delete
/******/ // The require function
[4] Fix | Delete
/******/ function __webpack_require__(moduleId) {
[5] Fix | Delete
/******/
[6] Fix | Delete
/******/ // Check if module is in cache
[7] Fix | Delete
/******/ if(installedModules[moduleId]) {
[8] Fix | Delete
/******/ return installedModules[moduleId].exports;
[9] Fix | Delete
/******/ }
[10] Fix | Delete
/******/ // Create a new module (and put it into the cache)
[11] Fix | Delete
/******/ var module = installedModules[moduleId] = {
[12] Fix | Delete
/******/ i: moduleId,
[13] Fix | Delete
/******/ l: false,
[14] Fix | Delete
/******/ exports: {}
[15] Fix | Delete
/******/ };
[16] Fix | Delete
/******/
[17] Fix | Delete
/******/ // Execute the module function
[18] Fix | Delete
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
[19] Fix | Delete
/******/
[20] Fix | Delete
/******/ // Flag the module as loaded
[21] Fix | Delete
/******/ module.l = true;
[22] Fix | Delete
/******/
[23] Fix | Delete
/******/ // Return the exports of the module
[24] Fix | Delete
/******/ return module.exports;
[25] Fix | Delete
/******/ }
[26] Fix | Delete
/******/
[27] Fix | Delete
/******/
[28] Fix | Delete
/******/ // expose the modules object (__webpack_modules__)
[29] Fix | Delete
/******/ __webpack_require__.m = modules;
[30] Fix | Delete
/******/
[31] Fix | Delete
/******/ // expose the module cache
[32] Fix | Delete
/******/ __webpack_require__.c = installedModules;
[33] Fix | Delete
/******/
[34] Fix | Delete
/******/ // define getter function for harmony exports
[35] Fix | Delete
/******/ __webpack_require__.d = function(exports, name, getter) {
[36] Fix | Delete
/******/ if(!__webpack_require__.o(exports, name)) {
[37] Fix | Delete
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
[38] Fix | Delete
/******/ }
[39] Fix | Delete
/******/ };
[40] Fix | Delete
/******/
[41] Fix | Delete
/******/ // define __esModule on exports
[42] Fix | Delete
/******/ __webpack_require__.r = function(exports) {
[43] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[44] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[45] Fix | Delete
/******/ }
[46] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[47] Fix | Delete
/******/ };
[48] Fix | Delete
/******/
[49] Fix | Delete
/******/ // create a fake namespace object
[50] Fix | Delete
/******/ // mode & 1: value is a module id, require it
[51] Fix | Delete
/******/ // mode & 2: merge all properties of value into the ns
[52] Fix | Delete
/******/ // mode & 4: return value when already ns object
[53] Fix | Delete
/******/ // mode & 8|1: behave like require
[54] Fix | Delete
/******/ __webpack_require__.t = function(value, mode) {
[55] Fix | Delete
/******/ if(mode & 1) value = __webpack_require__(value);
[56] Fix | Delete
/******/ if(mode & 8) return value;
[57] Fix | Delete
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
[58] Fix | Delete
/******/ var ns = Object.create(null);
[59] Fix | Delete
/******/ __webpack_require__.r(ns);
[60] Fix | Delete
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
[61] Fix | Delete
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
[62] Fix | Delete
/******/ return ns;
[63] Fix | Delete
/******/ };
[64] Fix | Delete
/******/
[65] Fix | Delete
/******/ // getDefaultExport function for compatibility with non-harmony modules
[66] Fix | Delete
/******/ __webpack_require__.n = function(module) {
[67] Fix | Delete
/******/ var getter = module && module.__esModule ?
[68] Fix | Delete
/******/ function getDefault() { return module['default']; } :
[69] Fix | Delete
/******/ function getModuleExports() { return module; };
[70] Fix | Delete
/******/ __webpack_require__.d(getter, 'a', getter);
[71] Fix | Delete
/******/ return getter;
[72] Fix | Delete
/******/ };
[73] Fix | Delete
/******/
[74] Fix | Delete
/******/ // Object.prototype.hasOwnProperty.call
[75] Fix | Delete
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
[76] Fix | Delete
/******/
[77] Fix | Delete
/******/ // __webpack_public_path__
[78] Fix | Delete
/******/ __webpack_require__.p = "";
[79] Fix | Delete
/******/
[80] Fix | Delete
/******/
[81] Fix | Delete
/******/ // Load entry module and return exports
[82] Fix | Delete
/******/ return __webpack_require__(__webpack_require__.s = 29);
[83] Fix | Delete
/******/ })
[84] Fix | Delete
/************************************************************************/
[85] Fix | Delete
/******/ (Array(29).concat([
[86] Fix | Delete
/* 29 */
[87] Fix | Delete
/***/ (function(module, exports, __webpack_require__) {
[88] Fix | Delete
[89] Fix | Delete
module.exports = __webpack_require__(30);
[90] Fix | Delete
[91] Fix | Delete
[92] Fix | Delete
/***/ }),
[93] Fix | Delete
/* 30 */
[94] Fix | Delete
/***/ (function(module, exports, __webpack_require__) {
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* @output wp-includes/js/media-views.js
[98] Fix | Delete
*/
[99] Fix | Delete
[100] Fix | Delete
var media = wp.media,
[101] Fix | Delete
$ = jQuery,
[102] Fix | Delete
l10n;
[103] Fix | Delete
[104] Fix | Delete
media.isTouchDevice = ( 'ontouchend' in document );
[105] Fix | Delete
[106] Fix | Delete
// Link any localized strings.
[107] Fix | Delete
l10n = media.view.l10n = window._wpMediaViewsL10n || {};
[108] Fix | Delete
[109] Fix | Delete
// Link any settings.
[110] Fix | Delete
media.view.settings = l10n.settings || {};
[111] Fix | Delete
delete l10n.settings;
[112] Fix | Delete
[113] Fix | Delete
// Copy the `post` setting over to the model settings.
[114] Fix | Delete
media.model.settings.post = media.view.settings.post;
[115] Fix | Delete
[116] Fix | Delete
// Check if the browser supports CSS 3.0 transitions.
[117] Fix | Delete
$.support.transition = (function(){
[118] Fix | Delete
var style = document.documentElement.style,
[119] Fix | Delete
transitions = {
[120] Fix | Delete
WebkitTransition: 'webkitTransitionEnd',
[121] Fix | Delete
MozTransition: 'transitionend',
[122] Fix | Delete
OTransition: 'oTransitionEnd otransitionend',
[123] Fix | Delete
transition: 'transitionend'
[124] Fix | Delete
}, transition;
[125] Fix | Delete
[126] Fix | Delete
transition = _.find( _.keys( transitions ), function( transition ) {
[127] Fix | Delete
return ! _.isUndefined( style[ transition ] );
[128] Fix | Delete
});
[129] Fix | Delete
[130] Fix | Delete
return transition && {
[131] Fix | Delete
end: transitions[ transition ]
[132] Fix | Delete
};
[133] Fix | Delete
}());
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* A shared event bus used to provide events into
[137] Fix | Delete
* the media workflows that 3rd-party devs can use to hook
[138] Fix | Delete
* in.
[139] Fix | Delete
*/
[140] Fix | Delete
media.events = _.extend( {}, Backbone.Events );
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Makes it easier to bind events using transitions.
[144] Fix | Delete
*
[145] Fix | Delete
* @param {string} selector
[146] Fix | Delete
* @param {number} sensitivity
[147] Fix | Delete
* @return {Promise}
[148] Fix | Delete
*/
[149] Fix | Delete
media.transition = function( selector, sensitivity ) {
[150] Fix | Delete
var deferred = $.Deferred();
[151] Fix | Delete
[152] Fix | Delete
sensitivity = sensitivity || 2000;
[153] Fix | Delete
[154] Fix | Delete
if ( $.support.transition ) {
[155] Fix | Delete
if ( ! (selector instanceof $) ) {
[156] Fix | Delete
selector = $( selector );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
// Resolve the deferred when the first element finishes animating.
[160] Fix | Delete
selector.first().one( $.support.transition.end, deferred.resolve );
[161] Fix | Delete
[162] Fix | Delete
// Just in case the event doesn't trigger, fire a callback.
[163] Fix | Delete
_.delay( deferred.resolve, sensitivity );
[164] Fix | Delete
[165] Fix | Delete
// Otherwise, execute on the spot.
[166] Fix | Delete
} else {
[167] Fix | Delete
deferred.resolve();
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
return deferred.promise();
[171] Fix | Delete
};
[172] Fix | Delete
[173] Fix | Delete
media.controller.Region = __webpack_require__( 31 );
[174] Fix | Delete
media.controller.StateMachine = __webpack_require__( 32 );
[175] Fix | Delete
media.controller.State = __webpack_require__( 33 );
[176] Fix | Delete
[177] Fix | Delete
media.selectionSync = __webpack_require__( 34 );
[178] Fix | Delete
media.controller.Library = __webpack_require__( 35 );
[179] Fix | Delete
media.controller.ImageDetails = __webpack_require__( 36 );
[180] Fix | Delete
media.controller.GalleryEdit = __webpack_require__( 37 );
[181] Fix | Delete
media.controller.GalleryAdd = __webpack_require__( 38 );
[182] Fix | Delete
media.controller.CollectionEdit = __webpack_require__( 39 );
[183] Fix | Delete
media.controller.CollectionAdd = __webpack_require__( 40 );
[184] Fix | Delete
media.controller.FeaturedImage = __webpack_require__( 41 );
[185] Fix | Delete
media.controller.ReplaceImage = __webpack_require__( 42 );
[186] Fix | Delete
media.controller.EditImage = __webpack_require__( 43 );
[187] Fix | Delete
media.controller.MediaLibrary = __webpack_require__( 44 );
[188] Fix | Delete
media.controller.Embed = __webpack_require__( 45 );
[189] Fix | Delete
media.controller.Cropper = __webpack_require__( 46 );
[190] Fix | Delete
media.controller.CustomizeImageCropper = __webpack_require__( 47 );
[191] Fix | Delete
media.controller.SiteIconCropper = __webpack_require__( 48 );
[192] Fix | Delete
[193] Fix | Delete
media.View = __webpack_require__( 49 );
[194] Fix | Delete
media.view.Frame = __webpack_require__( 50 );
[195] Fix | Delete
media.view.MediaFrame = __webpack_require__( 51 );
[196] Fix | Delete
media.view.MediaFrame.Select = __webpack_require__( 52 );
[197] Fix | Delete
media.view.MediaFrame.Post = __webpack_require__( 53 );
[198] Fix | Delete
media.view.MediaFrame.ImageDetails = __webpack_require__( 54 );
[199] Fix | Delete
media.view.Modal = __webpack_require__( 55 );
[200] Fix | Delete
media.view.FocusManager = __webpack_require__( 56 );
[201] Fix | Delete
media.view.UploaderWindow = __webpack_require__( 57 );
[202] Fix | Delete
media.view.EditorUploader = __webpack_require__( 58 );
[203] Fix | Delete
media.view.UploaderInline = __webpack_require__( 59 );
[204] Fix | Delete
media.view.UploaderStatus = __webpack_require__( 60 );
[205] Fix | Delete
media.view.UploaderStatusError = __webpack_require__( 61 );
[206] Fix | Delete
media.view.Toolbar = __webpack_require__( 62 );
[207] Fix | Delete
media.view.Toolbar.Select = __webpack_require__( 63 );
[208] Fix | Delete
media.view.Toolbar.Embed = __webpack_require__( 64 );
[209] Fix | Delete
media.view.Button = __webpack_require__( 65 );
[210] Fix | Delete
media.view.ButtonGroup = __webpack_require__( 66 );
[211] Fix | Delete
media.view.PriorityList = __webpack_require__( 67 );
[212] Fix | Delete
media.view.MenuItem = __webpack_require__( 68 );
[213] Fix | Delete
media.view.Menu = __webpack_require__( 69 );
[214] Fix | Delete
media.view.RouterItem = __webpack_require__( 70 );
[215] Fix | Delete
media.view.Router = __webpack_require__( 71 );
[216] Fix | Delete
media.view.Sidebar = __webpack_require__( 72 );
[217] Fix | Delete
media.view.Attachment = __webpack_require__( 73 );
[218] Fix | Delete
media.view.Attachment.Library = __webpack_require__( 74 );
[219] Fix | Delete
media.view.Attachment.EditLibrary = __webpack_require__( 75 );
[220] Fix | Delete
media.view.Attachments = __webpack_require__( 76 );
[221] Fix | Delete
media.view.Search = __webpack_require__( 77 );
[222] Fix | Delete
media.view.AttachmentFilters = __webpack_require__( 78 );
[223] Fix | Delete
media.view.DateFilter = __webpack_require__( 79 );
[224] Fix | Delete
media.view.AttachmentFilters.Uploaded = __webpack_require__( 80 );
[225] Fix | Delete
media.view.AttachmentFilters.All = __webpack_require__( 81 );
[226] Fix | Delete
media.view.AttachmentsBrowser = __webpack_require__( 82 );
[227] Fix | Delete
media.view.Selection = __webpack_require__( 83 );
[228] Fix | Delete
media.view.Attachment.Selection = __webpack_require__( 84 );
[229] Fix | Delete
media.view.Attachments.Selection = __webpack_require__( 85 );
[230] Fix | Delete
media.view.Attachment.EditSelection = __webpack_require__( 86 );
[231] Fix | Delete
media.view.Settings = __webpack_require__( 87 );
[232] Fix | Delete
media.view.Settings.AttachmentDisplay = __webpack_require__( 88 );
[233] Fix | Delete
media.view.Settings.Gallery = __webpack_require__( 89 );
[234] Fix | Delete
media.view.Settings.Playlist = __webpack_require__( 90 );
[235] Fix | Delete
media.view.Attachment.Details = __webpack_require__( 91 );
[236] Fix | Delete
media.view.AttachmentCompat = __webpack_require__( 92 );
[237] Fix | Delete
media.view.Iframe = __webpack_require__( 93 );
[238] Fix | Delete
media.view.Embed = __webpack_require__( 94 );
[239] Fix | Delete
media.view.Label = __webpack_require__( 95 );
[240] Fix | Delete
media.view.EmbedUrl = __webpack_require__( 96 );
[241] Fix | Delete
media.view.EmbedLink = __webpack_require__( 97 );
[242] Fix | Delete
media.view.EmbedImage = __webpack_require__( 98 );
[243] Fix | Delete
media.view.ImageDetails = __webpack_require__( 99 );
[244] Fix | Delete
media.view.Cropper = __webpack_require__( 100 );
[245] Fix | Delete
media.view.SiteIconCropper = __webpack_require__( 101 );
[246] Fix | Delete
media.view.SiteIconPreview = __webpack_require__( 102 );
[247] Fix | Delete
media.view.EditImage = __webpack_require__( 103 );
[248] Fix | Delete
media.view.Spinner = __webpack_require__( 104 );
[249] Fix | Delete
media.view.Heading = __webpack_require__( 105 );
[250] Fix | Delete
[251] Fix | Delete
[252] Fix | Delete
/***/ }),
[253] Fix | Delete
/* 31 */
[254] Fix | Delete
/***/ (function(module, exports) {
[255] Fix | Delete
[256] Fix | Delete
/**
[257] Fix | Delete
* wp.media.controller.Region
[258] Fix | Delete
*
[259] Fix | Delete
* A region is a persistent application layout area.
[260] Fix | Delete
*
[261] Fix | Delete
* A region assumes one mode at any time, and can be switched to another.
[262] Fix | Delete
*
[263] Fix | Delete
* When mode changes, events are triggered on the region's parent view.
[264] Fix | Delete
* The parent view will listen to specific events and fill the region with an
[265] Fix | Delete
* appropriate view depending on mode. For example, a frame listens for the
[266] Fix | Delete
* 'browse' mode t be activated on the 'content' view and then fills the region
[267] Fix | Delete
* with an AttachmentsBrowser view.
[268] Fix | Delete
*
[269] Fix | Delete
* @memberOf wp.media.controller
[270] Fix | Delete
*
[271] Fix | Delete
* @class
[272] Fix | Delete
*
[273] Fix | Delete
* @param {Object} options Options hash for the region.
[274] Fix | Delete
* @param {string} options.id Unique identifier for the region.
[275] Fix | Delete
* @param {Backbone.View} options.view A parent view the region exists within.
[276] Fix | Delete
* @param {string} options.selector jQuery selector for the region within the parent view.
[277] Fix | Delete
*/
[278] Fix | Delete
var Region = function( options ) {
[279] Fix | Delete
_.extend( this, _.pick( options || {}, 'id', 'view', 'selector' ) );
[280] Fix | Delete
};
[281] Fix | Delete
[282] Fix | Delete
// Use Backbone's self-propagating `extend` inheritance method.
[283] Fix | Delete
Region.extend = Backbone.Model.extend;
[284] Fix | Delete
[285] Fix | Delete
_.extend( Region.prototype,/** @lends wp.media.controller.Region.prototype */{
[286] Fix | Delete
/**
[287] Fix | Delete
* Activate a mode.
[288] Fix | Delete
*
[289] Fix | Delete
* @since 3.5.0
[290] Fix | Delete
*
[291] Fix | Delete
* @param {string} mode
[292] Fix | Delete
*
[293] Fix | Delete
* @fires Region#activate
[294] Fix | Delete
* @fires Region#deactivate
[295] Fix | Delete
*
[296] Fix | Delete
* @return {wp.media.controller.Region} Returns itself to allow chaining.
[297] Fix | Delete
*/
[298] Fix | Delete
mode: function( mode ) {
[299] Fix | Delete
if ( ! mode ) {
[300] Fix | Delete
return this._mode;
[301] Fix | Delete
}
[302] Fix | Delete
// Bail if we're trying to change to the current mode.
[303] Fix | Delete
if ( mode === this._mode ) {
[304] Fix | Delete
return this;
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
/**
[308] Fix | Delete
* Region mode deactivation event.
[309] Fix | Delete
*
[310] Fix | Delete
* @event wp.media.controller.Region#deactivate
[311] Fix | Delete
*/
[312] Fix | Delete
this.trigger('deactivate');
[313] Fix | Delete
[314] Fix | Delete
this._mode = mode;
[315] Fix | Delete
this.render( mode );
[316] Fix | Delete
[317] Fix | Delete
/**
[318] Fix | Delete
* Region mode activation event.
[319] Fix | Delete
*
[320] Fix | Delete
* @event wp.media.controller.Region#activate
[321] Fix | Delete
*/
[322] Fix | Delete
this.trigger('activate');
[323] Fix | Delete
return this;
[324] Fix | Delete
},
[325] Fix | Delete
/**
[326] Fix | Delete
* Render a mode.
[327] Fix | Delete
*
[328] Fix | Delete
* @since 3.5.0
[329] Fix | Delete
*
[330] Fix | Delete
* @param {string} mode
[331] Fix | Delete
*
[332] Fix | Delete
* @fires Region#create
[333] Fix | Delete
* @fires Region#render
[334] Fix | Delete
*
[335] Fix | Delete
* @return {wp.media.controller.Region} Returns itself to allow chaining.
[336] Fix | Delete
*/
[337] Fix | Delete
render: function( mode ) {
[338] Fix | Delete
// If the mode isn't active, activate it.
[339] Fix | Delete
if ( mode && mode !== this._mode ) {
[340] Fix | Delete
return this.mode( mode );
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
var set = { view: null },
[344] Fix | Delete
view;
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Create region view event.
[348] Fix | Delete
*
[349] Fix | Delete
* Region view creation takes place in an event callback on the frame.
[350] Fix | Delete
*
[351] Fix | Delete
* @event wp.media.controller.Region#create
[352] Fix | Delete
* @type {object}
[353] Fix | Delete
* @property {object} view
[354] Fix | Delete
*/
[355] Fix | Delete
this.trigger( 'create', set );
[356] Fix | Delete
view = set.view;
[357] Fix | Delete
[358] Fix | Delete
/**
[359] Fix | Delete
* Render region view event.
[360] Fix | Delete
*
[361] Fix | Delete
* Region view creation takes place in an event callback on the frame.
[362] Fix | Delete
*
[363] Fix | Delete
* @event wp.media.controller.Region#render
[364] Fix | Delete
* @type {object}
[365] Fix | Delete
*/
[366] Fix | Delete
this.trigger( 'render', view );
[367] Fix | Delete
if ( view ) {
[368] Fix | Delete
this.set( view );
[369] Fix | Delete
}
[370] Fix | Delete
return this;
[371] Fix | Delete
},
[372] Fix | Delete
[373] Fix | Delete
/**
[374] Fix | Delete
* Get the region's view.
[375] Fix | Delete
*
[376] Fix | Delete
* @since 3.5.0
[377] Fix | Delete
*
[378] Fix | Delete
* @return {wp.media.View}
[379] Fix | Delete
*/
[380] Fix | Delete
get: function() {
[381] Fix | Delete
return this.view.views.first( this.selector );
[382] Fix | Delete
},
[383] Fix | Delete
[384] Fix | Delete
/**
[385] Fix | Delete
* Set the region's view as a subview of the frame.
[386] Fix | Delete
*
[387] Fix | Delete
* @since 3.5.0
[388] Fix | Delete
*
[389] Fix | Delete
* @param {Array|Object} views
[390] Fix | Delete
* @param {Object} [options={}]
[391] Fix | Delete
* @return {wp.Backbone.Subviews} Subviews is returned to allow chaining.
[392] Fix | Delete
*/
[393] Fix | Delete
set: function( views, options ) {
[394] Fix | Delete
if ( options ) {
[395] Fix | Delete
options.add = false;
[396] Fix | Delete
}
[397] Fix | Delete
return this.view.views.set( this.selector, views, options );
[398] Fix | Delete
},
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* Trigger regional view events on the frame.
[402] Fix | Delete
*
[403] Fix | Delete
* @since 3.5.0
[404] Fix | Delete
*
[405] Fix | Delete
* @param {string} event
[406] Fix | Delete
* @return {undefined|wp.media.controller.Region} Returns itself to allow chaining.
[407] Fix | Delete
*/
[408] Fix | Delete
trigger: function( event ) {
[409] Fix | Delete
var base, args;
[410] Fix | Delete
[411] Fix | Delete
if ( ! this._mode ) {
[412] Fix | Delete
return;
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
args = _.toArray( arguments );
[416] Fix | Delete
base = this.id + ':' + event;
[417] Fix | Delete
[418] Fix | Delete
// Trigger `{this.id}:{event}:{this._mode}` event on the frame.
[419] Fix | Delete
args[0] = base + ':' + this._mode;
[420] Fix | Delete
this.view.trigger.apply( this.view, args );
[421] Fix | Delete
[422] Fix | Delete
// Trigger `{this.id}:{event}` event on the frame.
[423] Fix | Delete
args[0] = base;
[424] Fix | Delete
this.view.trigger.apply( this.view, args );
[425] Fix | Delete
return this;
[426] Fix | Delete
}
[427] Fix | Delete
});
[428] Fix | Delete
[429] Fix | Delete
module.exports = Region;
[430] Fix | Delete
[431] Fix | Delete
[432] Fix | Delete
/***/ }),
[433] Fix | Delete
/* 32 */
[434] Fix | Delete
/***/ (function(module, exports) {
[435] Fix | Delete
[436] Fix | Delete
/**
[437] Fix | Delete
* wp.media.controller.StateMachine
[438] Fix | Delete
*
[439] Fix | Delete
* A state machine keeps track of state. It is in one state at a time,
[440] Fix | Delete
* and can change from one state to another.
[441] Fix | Delete
*
[442] Fix | Delete
* States are stored as models in a Backbone collection.
[443] Fix | Delete
*
[444] Fix | Delete
* @memberOf wp.media.controller
[445] Fix | Delete
*
[446] Fix | Delete
* @since 3.5.0
[447] Fix | Delete
*
[448] Fix | Delete
* @class
[449] Fix | Delete
* @augments Backbone.Model
[450] Fix | Delete
* @mixin
[451] Fix | Delete
* @mixes Backbone.Events
[452] Fix | Delete
*/
[453] Fix | Delete
var StateMachine = function() {
[454] Fix | Delete
return {
[455] Fix | Delete
// Use Backbone's self-propagating `extend` inheritance method.
[456] Fix | Delete
extend: Backbone.Model.extend
[457] Fix | Delete
};
[458] Fix | Delete
};
[459] Fix | Delete
[460] Fix | Delete
_.extend( StateMachine.prototype, Backbone.Events,/** @lends wp.media.controller.StateMachine.prototype */{
[461] Fix | Delete
/**
[462] Fix | Delete
* Fetch a state.
[463] Fix | Delete
*
[464] Fix | Delete
* If no `id` is provided, returns the active state.
[465] Fix | Delete
*
[466] Fix | Delete
* Implicitly creates states.
[467] Fix | Delete
*
[468] Fix | Delete
* Ensure that the `states` collection exists so the `StateMachine`
[469] Fix | Delete
* can be used as a mixin.
[470] Fix | Delete
*
[471] Fix | Delete
* @since 3.5.0
[472] Fix | Delete
*
[473] Fix | Delete
* @param {string} id
[474] Fix | Delete
* @return {wp.media.controller.State} Returns a State model from
[475] Fix | Delete
* the StateMachine collection.
[476] Fix | Delete
*/
[477] Fix | Delete
state: function( id ) {
[478] Fix | Delete
this.states = this.states || new Backbone.Collection();
[479] Fix | Delete
[480] Fix | Delete
// Default to the active state.
[481] Fix | Delete
id = id || this._state;
[482] Fix | Delete
[483] Fix | Delete
if ( id && ! this.states.get( id ) ) {
[484] Fix | Delete
this.states.add({ id: id });
[485] Fix | Delete
}
[486] Fix | Delete
return this.states.get( id );
[487] Fix | Delete
},
[488] Fix | Delete
[489] Fix | Delete
/**
[490] Fix | Delete
* Sets the active state.
[491] Fix | Delete
*
[492] Fix | Delete
* Bail if we're trying to select the current state, if we haven't
[493] Fix | Delete
* created the `states` collection, or are trying to select a state
[494] Fix | Delete
* that does not exist.
[495] Fix | Delete
*
[496] Fix | Delete
* @since 3.5.0
[497] Fix | Delete
*
[498] Fix | Delete
* @param {string} id
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function