wp/wp-includes/js/media-views.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    34 /******/ 	__webpack_require__.c = installedModules;
    34 /******/ 	__webpack_require__.c = installedModules;
    35 /******/
    35 /******/
    36 /******/ 	// define getter function for harmony exports
    36 /******/ 	// define getter function for harmony exports
    37 /******/ 	__webpack_require__.d = function(exports, name, getter) {
    37 /******/ 	__webpack_require__.d = function(exports, name, getter) {
    38 /******/ 		if(!__webpack_require__.o(exports, name)) {
    38 /******/ 		if(!__webpack_require__.o(exports, name)) {
    39 /******/ 			Object.defineProperty(exports, name, {
    39 /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
    40 /******/ 				configurable: false,
       
    41 /******/ 				enumerable: true,
       
    42 /******/ 				get: getter
       
    43 /******/ 			});
       
    44 /******/ 		}
    40 /******/ 		}
       
    41 /******/ 	};
       
    42 /******/
       
    43 /******/ 	// define __esModule on exports
       
    44 /******/ 	__webpack_require__.r = function(exports) {
       
    45 /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
       
    46 /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
       
    47 /******/ 		}
       
    48 /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
       
    49 /******/ 	};
       
    50 /******/
       
    51 /******/ 	// create a fake namespace object
       
    52 /******/ 	// mode & 1: value is a module id, require it
       
    53 /******/ 	// mode & 2: merge all properties of value into the ns
       
    54 /******/ 	// mode & 4: return value when already ns object
       
    55 /******/ 	// mode & 8|1: behave like require
       
    56 /******/ 	__webpack_require__.t = function(value, mode) {
       
    57 /******/ 		if(mode & 1) value = __webpack_require__(value);
       
    58 /******/ 		if(mode & 8) return value;
       
    59 /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
       
    60 /******/ 		var ns = Object.create(null);
       
    61 /******/ 		__webpack_require__.r(ns);
       
    62 /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
       
    63 /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
       
    64 /******/ 		return ns;
    45 /******/ 	};
    65 /******/ 	};
    46 /******/
    66 /******/
    47 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
    67 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
    48 /******/ 	__webpack_require__.n = function(module) {
    68 /******/ 	__webpack_require__.n = function(module) {
    49 /******/ 		var getter = module && module.__esModule ?
    69 /******/ 		var getter = module && module.__esModule ?
    57 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
    77 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
    58 /******/
    78 /******/
    59 /******/ 	// __webpack_public_path__
    79 /******/ 	// __webpack_public_path__
    60 /******/ 	__webpack_require__.p = "";
    80 /******/ 	__webpack_require__.p = "";
    61 /******/
    81 /******/
       
    82 /******/
    62 /******/ 	// Load entry module and return exports
    83 /******/ 	// Load entry module and return exports
    63 /******/ 	return __webpack_require__(__webpack_require__.s = 26);
    84 /******/ 	return __webpack_require__(__webpack_require__.s = 29);
    64 /******/ })
    85 /******/ })
    65 /************************************************************************/
    86 /************************************************************************/
    66 /******/ (Array(26).concat([
    87 /******/ (Array(29).concat([
    67 /* 26 */
    88 /* 29 */
    68 /***/ (function(module, exports, __webpack_require__) {
    89 /***/ (function(module, exports, __webpack_require__) {
       
    90 
       
    91 module.exports = __webpack_require__(30);
       
    92 
       
    93 
       
    94 /***/ }),
       
    95 /* 30 */
       
    96 /***/ (function(module, exports, __webpack_require__) {
       
    97 
       
    98 /**
       
    99  * @output wp-includes/js/media-views.js
       
   100  */
    69 
   101 
    70 var media = wp.media,
   102 var media = wp.media,
    71 	$ = jQuery,
   103 	$ = jQuery,
    72 	l10n;
   104 	l10n;
    73 
   105 
   138 	}
   170 	}
   139 
   171 
   140 	return deferred.promise();
   172 	return deferred.promise();
   141 };
   173 };
   142 
   174 
   143 media.controller.Region = __webpack_require__( 27 );
   175 media.controller.Region = __webpack_require__( 31 );
   144 media.controller.StateMachine = __webpack_require__( 28 );
   176 media.controller.StateMachine = __webpack_require__( 32 );
   145 media.controller.State = __webpack_require__( 29 );
   177 media.controller.State = __webpack_require__( 33 );
   146 
   178 
   147 media.selectionSync = __webpack_require__( 30 );
   179 media.selectionSync = __webpack_require__( 34 );
   148 media.controller.Library = __webpack_require__( 31 );
   180 media.controller.Library = __webpack_require__( 35 );
   149 media.controller.ImageDetails = __webpack_require__( 32 );
   181 media.controller.ImageDetails = __webpack_require__( 36 );
   150 media.controller.GalleryEdit = __webpack_require__( 33 );
   182 media.controller.GalleryEdit = __webpack_require__( 37 );
   151 media.controller.GalleryAdd = __webpack_require__( 34 );
   183 media.controller.GalleryAdd = __webpack_require__( 38 );
   152 media.controller.CollectionEdit = __webpack_require__( 35 );
   184 media.controller.CollectionEdit = __webpack_require__( 39 );
   153 media.controller.CollectionAdd = __webpack_require__( 36 );
   185 media.controller.CollectionAdd = __webpack_require__( 40 );
   154 media.controller.FeaturedImage = __webpack_require__( 37 );
   186 media.controller.FeaturedImage = __webpack_require__( 41 );
   155 media.controller.ReplaceImage = __webpack_require__( 38 );
   187 media.controller.ReplaceImage = __webpack_require__( 42 );
   156 media.controller.EditImage = __webpack_require__( 39 );
   188 media.controller.EditImage = __webpack_require__( 43 );
   157 media.controller.MediaLibrary = __webpack_require__( 40 );
   189 media.controller.MediaLibrary = __webpack_require__( 44 );
   158 media.controller.Embed = __webpack_require__( 41 );
   190 media.controller.Embed = __webpack_require__( 45 );
   159 media.controller.Cropper = __webpack_require__( 42 );
   191 media.controller.Cropper = __webpack_require__( 46 );
   160 media.controller.CustomizeImageCropper = __webpack_require__( 43 );
   192 media.controller.CustomizeImageCropper = __webpack_require__( 47 );
   161 media.controller.SiteIconCropper = __webpack_require__( 44 );
   193 media.controller.SiteIconCropper = __webpack_require__( 48 );
   162 
   194 
   163 media.View = __webpack_require__( 45 );
   195 media.View = __webpack_require__( 49 );
   164 media.view.Frame = __webpack_require__( 46 );
   196 media.view.Frame = __webpack_require__( 50 );
   165 media.view.MediaFrame = __webpack_require__( 47 );
   197 media.view.MediaFrame = __webpack_require__( 51 );
   166 media.view.MediaFrame.Select = __webpack_require__( 48 );
   198 media.view.MediaFrame.Select = __webpack_require__( 52 );
   167 media.view.MediaFrame.Post = __webpack_require__( 49 );
   199 media.view.MediaFrame.Post = __webpack_require__( 53 );
   168 media.view.MediaFrame.ImageDetails = __webpack_require__( 50 );
   200 media.view.MediaFrame.ImageDetails = __webpack_require__( 54 );
   169 media.view.Modal = __webpack_require__( 51 );
   201 media.view.Modal = __webpack_require__( 55 );
   170 media.view.FocusManager = __webpack_require__( 52 );
   202 media.view.FocusManager = __webpack_require__( 56 );
   171 media.view.UploaderWindow = __webpack_require__( 53 );
   203 media.view.UploaderWindow = __webpack_require__( 57 );
   172 media.view.EditorUploader = __webpack_require__( 54 );
   204 media.view.EditorUploader = __webpack_require__( 58 );
   173 media.view.UploaderInline = __webpack_require__( 55 );
   205 media.view.UploaderInline = __webpack_require__( 59 );
   174 media.view.UploaderStatus = __webpack_require__( 56 );
   206 media.view.UploaderStatus = __webpack_require__( 60 );
   175 media.view.UploaderStatusError = __webpack_require__( 57 );
   207 media.view.UploaderStatusError = __webpack_require__( 61 );
   176 media.view.Toolbar = __webpack_require__( 58 );
   208 media.view.Toolbar = __webpack_require__( 62 );
   177 media.view.Toolbar.Select = __webpack_require__( 59 );
   209 media.view.Toolbar.Select = __webpack_require__( 63 );
   178 media.view.Toolbar.Embed = __webpack_require__( 60 );
   210 media.view.Toolbar.Embed = __webpack_require__( 64 );
   179 media.view.Button = __webpack_require__( 61 );
   211 media.view.Button = __webpack_require__( 65 );
   180 media.view.ButtonGroup = __webpack_require__( 62 );
   212 media.view.ButtonGroup = __webpack_require__( 66 );
   181 media.view.PriorityList = __webpack_require__( 63 );
   213 media.view.PriorityList = __webpack_require__( 67 );
   182 media.view.MenuItem = __webpack_require__( 64 );
   214 media.view.MenuItem = __webpack_require__( 68 );
   183 media.view.Menu = __webpack_require__( 65 );
   215 media.view.Menu = __webpack_require__( 69 );
   184 media.view.RouterItem = __webpack_require__( 66 );
   216 media.view.RouterItem = __webpack_require__( 70 );
   185 media.view.Router = __webpack_require__( 67 );
   217 media.view.Router = __webpack_require__( 71 );
   186 media.view.Sidebar = __webpack_require__( 68 );
   218 media.view.Sidebar = __webpack_require__( 72 );
   187 media.view.Attachment = __webpack_require__( 69 );
   219 media.view.Attachment = __webpack_require__( 73 );
   188 media.view.Attachment.Library = __webpack_require__( 70 );
   220 media.view.Attachment.Library = __webpack_require__( 74 );
   189 media.view.Attachment.EditLibrary = __webpack_require__( 71 );
   221 media.view.Attachment.EditLibrary = __webpack_require__( 75 );
   190 media.view.Attachments = __webpack_require__( 72 );
   222 media.view.Attachments = __webpack_require__( 76 );
   191 media.view.Search = __webpack_require__( 73 );
   223 media.view.Search = __webpack_require__( 77 );
   192 media.view.AttachmentFilters = __webpack_require__( 74 );
   224 media.view.AttachmentFilters = __webpack_require__( 78 );
   193 media.view.DateFilter = __webpack_require__( 75 );
   225 media.view.DateFilter = __webpack_require__( 79 );
   194 media.view.AttachmentFilters.Uploaded = __webpack_require__( 76 );
   226 media.view.AttachmentFilters.Uploaded = __webpack_require__( 80 );
   195 media.view.AttachmentFilters.All = __webpack_require__( 77 );
   227 media.view.AttachmentFilters.All = __webpack_require__( 81 );
   196 media.view.AttachmentsBrowser = __webpack_require__( 78 );
   228 media.view.AttachmentsBrowser = __webpack_require__( 82 );
   197 media.view.Selection = __webpack_require__( 79 );
   229 media.view.Selection = __webpack_require__( 83 );
   198 media.view.Attachment.Selection = __webpack_require__( 80 );
   230 media.view.Attachment.Selection = __webpack_require__( 84 );
   199 media.view.Attachments.Selection = __webpack_require__( 81 );
   231 media.view.Attachments.Selection = __webpack_require__( 85 );
   200 media.view.Attachment.EditSelection = __webpack_require__( 82 );
   232 media.view.Attachment.EditSelection = __webpack_require__( 86 );
   201 media.view.Settings = __webpack_require__( 83 );
   233 media.view.Settings = __webpack_require__( 87 );
   202 media.view.Settings.AttachmentDisplay = __webpack_require__( 84 );
   234 media.view.Settings.AttachmentDisplay = __webpack_require__( 88 );
   203 media.view.Settings.Gallery = __webpack_require__( 85 );
   235 media.view.Settings.Gallery = __webpack_require__( 89 );
   204 media.view.Settings.Playlist = __webpack_require__( 86 );
   236 media.view.Settings.Playlist = __webpack_require__( 90 );
   205 media.view.Attachment.Details = __webpack_require__( 87 );
   237 media.view.Attachment.Details = __webpack_require__( 91 );
   206 media.view.AttachmentCompat = __webpack_require__( 88 );
   238 media.view.AttachmentCompat = __webpack_require__( 92 );
   207 media.view.Iframe = __webpack_require__( 89 );
   239 media.view.Iframe = __webpack_require__( 93 );
   208 media.view.Embed = __webpack_require__( 90 );
   240 media.view.Embed = __webpack_require__( 94 );
   209 media.view.Label = __webpack_require__( 91 );
   241 media.view.Label = __webpack_require__( 95 );
   210 media.view.EmbedUrl = __webpack_require__( 92 );
   242 media.view.EmbedUrl = __webpack_require__( 96 );
   211 media.view.EmbedLink = __webpack_require__( 93 );
   243 media.view.EmbedLink = __webpack_require__( 97 );
   212 media.view.EmbedImage = __webpack_require__( 94 );
   244 media.view.EmbedImage = __webpack_require__( 98 );
   213 media.view.ImageDetails = __webpack_require__( 95 );
   245 media.view.ImageDetails = __webpack_require__( 99 );
   214 media.view.Cropper = __webpack_require__( 96 );
   246 media.view.Cropper = __webpack_require__( 100 );
   215 media.view.SiteIconCropper = __webpack_require__( 97 );
   247 media.view.SiteIconCropper = __webpack_require__( 101 );
   216 media.view.SiteIconPreview = __webpack_require__( 98 );
   248 media.view.SiteIconPreview = __webpack_require__( 102 );
   217 media.view.EditImage = __webpack_require__( 99 );
   249 media.view.EditImage = __webpack_require__( 103 );
   218 media.view.Spinner = __webpack_require__( 100 );
   250 media.view.Spinner = __webpack_require__( 104 );
       
   251 media.view.Heading = __webpack_require__( 105 );
   219 
   252 
   220 
   253 
   221 /***/ }),
   254 /***/ }),
   222 /* 27 */
   255 /* 31 */
   223 /***/ (function(module, exports) {
   256 /***/ (function(module, exports) {
   224 
   257 
   225 /**
   258 /**
   226  * wp.media.controller.Region
   259  * wp.media.controller.Region
   227  *
   260  *
   397 
   430 
   398 module.exports = Region;
   431 module.exports = Region;
   399 
   432 
   400 
   433 
   401 /***/ }),
   434 /***/ }),
   402 /* 28 */
   435 /* 32 */
   403 /***/ (function(module, exports) {
   436 /***/ (function(module, exports) {
   404 
   437 
   405 /**
   438 /**
   406  * wp.media.controller.StateMachine
   439  * wp.media.controller.StateMachine
   407  *
   440  *
   542 
   575 
   543 module.exports = StateMachine;
   576 module.exports = StateMachine;
   544 
   577 
   545 
   578 
   546 /***/ }),
   579 /***/ }),
   547 /* 29 */
   580 /* 33 */
   548 /***/ (function(module, exports) {
   581 /***/ (function(module, exports) {
   549 
   582 
   550 /**
   583 /**
   551  * wp.media.controller.State
   584  * wp.media.controller.State
   552  *
   585  *
   789 
   822 
   790 module.exports = State;
   823 module.exports = State;
   791 
   824 
   792 
   825 
   793 /***/ }),
   826 /***/ }),
   794 /* 30 */
   827 /* 34 */
   795 /***/ (function(module, exports) {
   828 /***/ (function(module, exports) {
   796 
   829 
   797 /**
   830 /**
   798  * wp.media.selectionSync
   831  * wp.media.selectionSync
   799  *
   832  *
   861 
   894 
   862 module.exports = selectionSync;
   895 module.exports = selectionSync;
   863 
   896 
   864 
   897 
   865 /***/ }),
   898 /***/ }),
   866 /* 31 */
   899 /* 35 */
   867 /***/ (function(module, exports) {
   900 /***/ (function(module, exports) {
   868 
   901 
   869 var l10n = wp.media.view.l10n,
   902 var l10n = wp.media.view.l10n,
   870 	getUserSetting = window.getUserSetting,
   903 	getUserSetting = window.getUserSetting,
   871 	setUserSetting = window.setUserSetting,
   904 	setUserSetting = window.setUserSetting,
  1161 
  1194 
  1162 module.exports = Library;
  1195 module.exports = Library;
  1163 
  1196 
  1164 
  1197 
  1165 /***/ }),
  1198 /***/ }),
  1166 /* 32 */
  1199 /* 36 */
  1167 /***/ (function(module, exports) {
  1200 /***/ (function(module, exports) {
  1168 
  1201 
  1169 var State = wp.media.controller.State,
  1202 var State = wp.media.controller.State,
  1170 	Library = wp.media.controller.Library,
  1203 	Library = wp.media.controller.Library,
  1171 	l10n = wp.media.view.l10n,
  1204 	l10n = wp.media.view.l10n,
  1229 
  1262 
  1230 module.exports = ImageDetails;
  1263 module.exports = ImageDetails;
  1231 
  1264 
  1232 
  1265 
  1233 /***/ }),
  1266 /***/ }),
  1234 /* 33 */
  1267 /* 37 */
  1235 /***/ (function(module, exports) {
  1268 /***/ (function(module, exports) {
  1236 
  1269 
  1237 var Library = wp.media.controller.Library,
  1270 var Library = wp.media.controller.Library,
  1238 	l10n = wp.media.view.l10n,
  1271 	l10n = wp.media.view.l10n,
  1239 	GalleryEdit;
  1272 	GalleryEdit;
  1241 /**
  1274 /**
  1242  * wp.media.controller.GalleryEdit
  1275  * wp.media.controller.GalleryEdit
  1243  *
  1276  *
  1244  * A state for editing a gallery's images and settings.
  1277  * A state for editing a gallery's images and settings.
  1245  *
  1278  *
  1246  * @memberOf wp.media.controller
  1279  * @since 3.5.0
  1247  *
  1280  *
  1248  * @class
  1281  * @class
  1249  * @augments wp.media.controller.Library
  1282  * @augments wp.media.controller.Library
  1250  * @augments wp.media.controller.State
  1283  * @augments wp.media.controller.State
  1251  * @augments Backbone.Model
  1284  * @augments Backbone.Model
  1252  *
  1285  *
  1253  * @param {object}                     [attributes]                       The attributes hash passed to the state.
  1286  * @memberOf wp.media.controller
       
  1287  *
       
  1288  * @param {Object}                     [attributes]                       The attributes hash passed to the state.
  1254  * @param {string}                     [attributes.id=gallery-edit]       Unique identifier.
  1289  * @param {string}                     [attributes.id=gallery-edit]       Unique identifier.
  1255  * @param {string}                     [attributes.title=Edit Gallery]    Title for the state. Displays in the frame's title region.
  1290  * @param {string}                     [attributes.title=Edit Gallery]    Title for the state. Displays in the frame's title region.
  1256  * @param {wp.media.model.Attachments} [attributes.library]               The collection of attachments in the gallery.
  1291  * @param {wp.media.model.Attachments} [attributes.library]               The collection of attachments in the gallery.
  1257  *                                                                        If one is not supplied, an empty media.model.Selection collection is created.
  1292  *                                                                        If one is not supplied, an empty media.model.Selection collection is created.
  1258  * @param {boolean}                    [attributes.multiple=false]        Whether multi-select is enabled.
  1293  * @param {boolean}                    [attributes.multiple=false]        Whether multi-select is enabled.
  1262  * @param {string|false}               [attributes.content=browse]        Initial mode for the content region.
  1297  * @param {string|false}               [attributes.content=browse]        Initial mode for the content region.
  1263  * @param {string|false}               [attributes.toolbar=image-details] Initial mode for the toolbar region.
  1298  * @param {string|false}               [attributes.toolbar=image-details] Initial mode for the toolbar region.
  1264  * @param {boolean}                    [attributes.describe=true]         Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
  1299  * @param {boolean}                    [attributes.describe=true]         Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
  1265  * @param {boolean}                    [attributes.displaySettings=true]  Whether to show the attachment display settings interface.
  1300  * @param {boolean}                    [attributes.displaySettings=true]  Whether to show the attachment display settings interface.
  1266  * @param {boolean}                    [attributes.dragInfo=true]         Whether to show instructional text about the attachments being sortable.
  1301  * @param {boolean}                    [attributes.dragInfo=true]         Whether to show instructional text about the attachments being sortable.
  1267  * @param {int}                        [attributes.idealColumnWidth=170]  The ideal column width in pixels for attachments.
  1302  * @param {number}                     [attributes.idealColumnWidth=170]  The ideal column width in pixels for attachments.
  1268  * @param {boolean}                    [attributes.editing=false]         Whether the gallery is being created, or editing an existing instance.
  1303  * @param {boolean}                    [attributes.editing=false]         Whether the gallery is being created, or editing an existing instance.
  1269  * @param {int}                        [attributes.priority=60]           The priority for the state link in the media menu.
  1304  * @param {number}                     [attributes.priority=60]           The priority for the state link in the media menu.
  1270  * @param {boolean}                    [attributes.syncSelection=false]   Whether the Attachments selection should be persisted from the last state.
  1305  * @param {boolean}                    [attributes.syncSelection=false]   Whether the Attachments selection should be persisted from the last state.
  1271  *                                                                        Defaults to false for this state, because the library passed in  *is* the selection.
  1306  *                                                                        Defaults to false for this state, because the library passed in  *is* the selection.
  1272  * @param {view}                       [attributes.AttachmentView]        The single `Attachment` view to be used in the `Attachments`.
  1307  * @param {view}                       [attributes.AttachmentView]        The single `Attachment` view to be used in the `Attachments`.
  1273  *                                                                        If none supplied, defaults to wp.media.view.Attachment.EditLibrary.
  1308  *                                                                        If none supplied, defaults to wp.media.view.Attachment.EditLibrary.
  1274  */
  1309  */
  1291 		priority:         60,
  1326 		priority:         60,
  1292 		syncSelection:    false
  1327 		syncSelection:    false
  1293 	},
  1328 	},
  1294 
  1329 
  1295 	/**
  1330 	/**
       
  1331 	 * Initializes the library.
       
  1332 	 *
       
  1333 	 * Creates a selection if a library isn't supplied and creates an attachment
       
  1334 	 * view if no attachment view is supplied.
       
  1335 	 *
  1296 	 * @since 3.5.0
  1336 	 * @since 3.5.0
       
  1337 	 *
       
  1338 	 * @return {void}
  1297 	 */
  1339 	 */
  1298 	initialize: function() {
  1340 	initialize: function() {
  1299 		// If we haven't been provided a `library`, create a `Selection`.
  1341 		// If we haven't been provided a `library`, create a `Selection`.
  1300 		if ( ! this.get('library') ) {
  1342 		if ( ! this.get('library') ) {
  1301 			this.set( 'library', new wp.media.model.Selection() );
  1343 			this.set( 'library', new wp.media.model.Selection() );
  1308 
  1350 
  1309 		Library.prototype.initialize.apply( this, arguments );
  1351 		Library.prototype.initialize.apply( this, arguments );
  1310 	},
  1352 	},
  1311 
  1353 
  1312 	/**
  1354 	/**
       
  1355 	 * Activates the library.
       
  1356 	 *
       
  1357 	 * Limits the library to images, watches for uploaded attachments. Watches for
       
  1358 	 * the browse event on the frame and binds it to gallerySettings.
       
  1359 	 *
  1313 	 * @since 3.5.0
  1360 	 * @since 3.5.0
       
  1361 	 *
       
  1362 	 * @return {void}
  1314 	 */
  1363 	 */
  1315 	activate: function() {
  1364 	activate: function() {
  1316 		var library = this.get('library');
  1365 		var library = this.get('library');
  1317 
  1366 
  1318 		// Limit the library to images only.
  1367 		// Limit the library to images only.
  1325 
  1374 
  1326 		Library.prototype.activate.apply( this, arguments );
  1375 		Library.prototype.activate.apply( this, arguments );
  1327 	},
  1376 	},
  1328 
  1377 
  1329 	/**
  1378 	/**
       
  1379 	 * Deactivates the library.
       
  1380 	 *
       
  1381 	 * Stops watching for uploaded attachments and browse events.
       
  1382 	 *
  1330 	 * @since 3.5.0
  1383 	 * @since 3.5.0
       
  1384 	 *
       
  1385 	 * @return {void}
  1331 	 */
  1386 	 */
  1332 	deactivate: function() {
  1387 	deactivate: function() {
  1333 		// Stop watching for uploaded attachments.
  1388 		// Stop watching for uploaded attachments.
  1334 		this.get('library').unobserve( wp.Uploader.queue );
  1389 		this.get('library').unobserve( wp.Uploader.queue );
  1335 
  1390 
  1337 
  1392 
  1338 		Library.prototype.deactivate.apply( this, arguments );
  1393 		Library.prototype.deactivate.apply( this, arguments );
  1339 	},
  1394 	},
  1340 
  1395 
  1341 	/**
  1396 	/**
       
  1397 	 * Adds the gallery settings to the sidebar and adds a reverse button to the
       
  1398 	 * toolbar.
       
  1399 	 *
  1342 	 * @since 3.5.0
  1400 	 * @since 3.5.0
  1343 	 *
  1401 	 *
  1344 	 * @param browser
  1402 	 * @param {wp.media.view.Frame} browser The file browser.
       
  1403 	 *
       
  1404 	 * @return {void}
  1345 	 */
  1405 	 */
  1346 	gallerySettings: function( browser ) {
  1406 	gallerySettings: function( browser ) {
  1347 		if ( ! this.get('displaySettings') ) {
  1407 		if ( ! this.get('displaySettings') ) {
  1348 			return;
  1408 			return;
  1349 		}
  1409 		}
  1377 
  1437 
  1378 module.exports = GalleryEdit;
  1438 module.exports = GalleryEdit;
  1379 
  1439 
  1380 
  1440 
  1381 /***/ }),
  1441 /***/ }),
  1382 /* 34 */
  1442 /* 38 */
  1383 /***/ (function(module, exports) {
  1443 /***/ (function(module, exports) {
  1384 
  1444 
  1385 var Selection = wp.media.model.Selection,
  1445 var Selection = wp.media.model.Selection,
  1386 	Library = wp.media.controller.Library,
  1446 	Library = wp.media.controller.Library,
  1387 	l10n = wp.media.view.l10n,
  1447 	l10n = wp.media.view.l10n,
  1390 /**
  1450 /**
  1391  * wp.media.controller.GalleryAdd
  1451  * wp.media.controller.GalleryAdd
  1392  *
  1452  *
  1393  * A state for selecting more images to add to a gallery.
  1453  * A state for selecting more images to add to a gallery.
  1394  *
  1454  *
  1395  * @memberOf wp.media.controller
  1455  * @since 3.5.0
  1396  *
  1456  *
  1397  * @class
  1457  * @class
  1398  * @augments wp.media.controller.Library
  1458  * @augments wp.media.controller.Library
  1399  * @augments wp.media.controller.State
  1459  * @augments wp.media.controller.State
  1400  * @augments Backbone.Model
  1460  * @augments Backbone.Model
  1401  *
  1461  *
  1402  * @param {object}                     [attributes]                         The attributes hash passed to the state.
  1462  * @memberof wp.media.controller
       
  1463  *
       
  1464  * @param {Object}                     [attributes]                         The attributes hash passed to the state.
  1403  * @param {string}                     [attributes.id=gallery-library]      Unique identifier.
  1465  * @param {string}                     [attributes.id=gallery-library]      Unique identifier.
  1404  * @param {string}                     [attributes.title=Add to Gallery]    Title for the state. Displays in the frame's title region.
  1466  * @param {string}                     [attributes.title=Add to Gallery]    Title for the state. Displays in the frame's title region.
  1405  * @param {boolean}                    [attributes.multiple=add]            Whether multi-select is enabled. @todo 'add' doesn't seem do anything special, and gets used as a boolean.
  1467  * @param {boolean}                    [attributes.multiple=add]            Whether multi-select is enabled. @todo 'add' doesn't seem do anything special, and gets used as a boolean.
  1406  * @param {wp.media.model.Attachments} [attributes.library]                 The attachments collection to browse.
  1468  * @param {wp.media.model.Attachments} [attributes.library]                 The attachments collection to browse.
  1407  *                                                                          If one is not supplied, a collection of all images will be created.
  1469  *                                                                          If one is not supplied, a collection of all images will be created.
  1414  * @param {string}                     [attributes.toolbar=gallery-add]     Initial mode for the toolbar region.
  1476  * @param {string}                     [attributes.toolbar=gallery-add]     Initial mode for the toolbar region.
  1415  * @param {boolean}                    [attributes.searchable=true]         Whether the library is searchable.
  1477  * @param {boolean}                    [attributes.searchable=true]         Whether the library is searchable.
  1416  * @param {boolean}                    [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
  1478  * @param {boolean}                    [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
  1417  * @param {boolean}                    [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
  1479  * @param {boolean}                    [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
  1418  * @param {boolean}                    [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
  1480  * @param {boolean}                    [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
  1419  * @param {int}                        [attributes.priority=100]            The priority for the state link in the media menu.
  1481  * @param {number}                     [attributes.priority=100]            The priority for the state link in the media menu.
  1420  * @param {boolean}                    [attributes.syncSelection=false]     Whether the Attachments selection should be persisted from the last state.
  1482  * @param {boolean}                    [attributes.syncSelection=false]     Whether the Attachments selection should be persisted from the last state.
  1421  *                                                                          Defaults to false because for this state, because the library of the Edit Gallery state is the selection.
  1483  *                                                                          Defaults to false because for this state, because the library of the Edit Gallery state is the selection.
  1422  */
  1484  */
  1423 GalleryAdd = Library.extend(/** @lends wp.media.controller.GalleryAdd.prototype */{
  1485 GalleryAdd = Library.extend(/** @lends wp.media.controller.GalleryAdd.prototype */{
  1424 	defaults: _.defaults({
  1486 	defaults: _.defaults({
  1431 		priority:      100,
  1493 		priority:      100,
  1432 		syncSelection: false
  1494 		syncSelection: false
  1433 	}, Library.prototype.defaults ),
  1495 	}, Library.prototype.defaults ),
  1434 
  1496 
  1435 	/**
  1497 	/**
       
  1498 	 * Initializes the library. Creates a library of images if a library isn't supplied.
       
  1499 	 *
  1436 	 * @since 3.5.0
  1500 	 * @since 3.5.0
       
  1501 	 *
       
  1502 	 * @returns {void}
  1437 	 */
  1503 	 */
  1438 	initialize: function() {
  1504 	initialize: function() {
  1439 		// If a library wasn't supplied, create a library of images.
       
  1440 		if ( ! this.get('library') ) {
  1505 		if ( ! this.get('library') ) {
  1441 			this.set( 'library', wp.media.query({ type: 'image' }) );
  1506 			this.set( 'library', wp.media.query({ type: 'image' }) );
  1442 		}
  1507 		}
  1443 
  1508 
  1444 		Library.prototype.initialize.apply( this, arguments );
  1509 		Library.prototype.initialize.apply( this, arguments );
  1445 	},
  1510 	},
  1446 
  1511 
  1447 	/**
  1512 	/**
       
  1513 	 * Activates the library.
       
  1514 	 *
       
  1515 	 * Removes all event listeners if in edit mode. Creates a validator to check an attachment.
       
  1516 	 * Resets library and re-enables event listeners. Activates edit mode. Calls the parent's activate method.
       
  1517 	 *
  1448 	 * @since 3.5.0
  1518 	 * @since 3.5.0
       
  1519 	 *
       
  1520 	 * @returns {void}
  1449 	 */
  1521 	 */
  1450 	activate: function() {
  1522 	activate: function() {
  1451 		var library = this.get('library'),
  1523 		var library = this.get('library'),
  1452 			edit    = this.frame.state('gallery-edit').get('library');
  1524 			edit    = this.frame.state('gallery-edit').get('library');
  1453 
  1525 
  1454 		if ( this.editLibrary && this.editLibrary !== edit ) {
  1526 		if ( this.editLibrary && this.editLibrary !== edit ) {
  1455 			library.unobserve( this.editLibrary );
  1527 			library.unobserve( this.editLibrary );
  1456 		}
  1528 		}
  1457 
  1529 
  1458 		// Accepts attachments that exist in the original library and
  1530 		/*
  1459 		// that do not exist in gallery's library.
  1531 		 * Accept attachments that exist in the original library but
       
  1532 		 * that do not exist in gallery's library yet.
       
  1533 		 */
  1460 		library.validator = function( attachment ) {
  1534 		library.validator = function( attachment ) {
  1461 			return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && Selection.prototype.validator.apply( this, arguments );
  1535 			return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && Selection.prototype.validator.apply( this, arguments );
  1462 		};
  1536 		};
  1463 
  1537 
  1464 		// Reset the library to ensure that all attachments are re-added
  1538 		/*
  1465 		// to the collection. Do so silently, as calling `observe` will
  1539 		 * Reset the library to ensure that all attachments are re-added
  1466 		// trigger the `reset` event.
  1540 		 * to the collection. Do so silently, as calling `observe` will
       
  1541 		 * trigger the `reset` event.
       
  1542 		 */
  1467 		library.reset( library.mirroring.models, { silent: true });
  1543 		library.reset( library.mirroring.models, { silent: true });
  1468 		library.observe( edit );
  1544 		library.observe( edit );
  1469 		this.editLibrary = edit;
  1545 		this.editLibrary = edit;
  1470 
  1546 
  1471 		Library.prototype.activate.apply( this, arguments );
  1547 		Library.prototype.activate.apply( this, arguments );
  1474 
  1550 
  1475 module.exports = GalleryAdd;
  1551 module.exports = GalleryAdd;
  1476 
  1552 
  1477 
  1553 
  1478 /***/ }),
  1554 /***/ }),
  1479 /* 35 */
  1555 /* 39 */
  1480 /***/ (function(module, exports) {
  1556 /***/ (function(module, exports) {
  1481 
  1557 
  1482 var Library = wp.media.controller.Library,
  1558 var Library = wp.media.controller.Library,
  1483 	l10n = wp.media.view.l10n,
  1559 	l10n = wp.media.view.l10n,
  1484 	$ = jQuery,
  1560 	$ = jQuery,
  1642 
  1718 
  1643 module.exports = CollectionEdit;
  1719 module.exports = CollectionEdit;
  1644 
  1720 
  1645 
  1721 
  1646 /***/ }),
  1722 /***/ }),
  1647 /* 36 */
  1723 /* 40 */
  1648 /***/ (function(module, exports) {
  1724 /***/ (function(module, exports) {
  1649 
  1725 
  1650 var Selection = wp.media.model.Selection,
  1726 var Selection = wp.media.model.Selection,
  1651 	Library = wp.media.controller.Library,
  1727 	Library = wp.media.controller.Library,
  1652 	CollectionAdd;
  1728 	CollectionAdd;
  1749 
  1825 
  1750 module.exports = CollectionAdd;
  1826 module.exports = CollectionAdd;
  1751 
  1827 
  1752 
  1828 
  1753 /***/ }),
  1829 /***/ }),
  1754 /* 37 */
  1830 /* 41 */
  1755 /***/ (function(module, exports) {
  1831 /***/ (function(module, exports) {
  1756 
  1832 
  1757 var Attachment = wp.media.model.Attachment,
  1833 var Attachment = wp.media.model.Attachment,
  1758 	Library = wp.media.controller.Library,
  1834 	Library = wp.media.controller.Library,
  1759 	l10n = wp.media.view.l10n,
  1835 	l10n = wp.media.view.l10n,
  1877 
  1953 
  1878 module.exports = FeaturedImage;
  1954 module.exports = FeaturedImage;
  1879 
  1955 
  1880 
  1956 
  1881 /***/ }),
  1957 /***/ }),
  1882 /* 38 */
  1958 /* 42 */
  1883 /***/ (function(module, exports) {
  1959 /***/ (function(module, exports) {
  1884 
  1960 
  1885 var Library = wp.media.controller.Library,
  1961 var Library = wp.media.controller.Library,
  1886 	l10n = wp.media.view.l10n,
  1962 	l10n = wp.media.view.l10n,
  1887 	ReplaceImage;
  1963 	ReplaceImage;
  1991 
  2067 
  1992 module.exports = ReplaceImage;
  2068 module.exports = ReplaceImage;
  1993 
  2069 
  1994 
  2070 
  1995 /***/ }),
  2071 /***/ }),
  1996 /* 39 */
  2072 /* 43 */
  1997 /***/ (function(module, exports) {
  2073 /***/ (function(module, exports) {
  1998 
  2074 
  1999 var l10n = wp.media.view.l10n,
  2075 var l10n = wp.media.view.l10n,
  2000 	EditImage;
  2076 	EditImage;
  2001 
  2077 
  2028 		content: 'edit-image',
  2104 		content: 'edit-image',
  2029 		url:     ''
  2105 		url:     ''
  2030 	},
  2106 	},
  2031 
  2107 
  2032 	/**
  2108 	/**
       
  2109 	 * Activates a frame for editing a featured image.
       
  2110 	 *
  2033 	 * @since 3.9.0
  2111 	 * @since 3.9.0
       
  2112 	 *
       
  2113 	 * @returns {void}
  2034 	 */
  2114 	 */
  2035 	activate: function() {
  2115 	activate: function() {
  2036 		this.frame.on( 'toolbar:render:edit-image', _.bind( this.toolbar, this ) );
  2116 		this.frame.on( 'toolbar:render:edit-image', _.bind( this.toolbar, this ) );
  2037 	},
  2117 	},
  2038 
  2118 
  2039 	/**
  2119 	/**
       
  2120 	 * Deactivates a frame for editing a featured image.
       
  2121 	 *
  2040 	 * @since 3.9.0
  2122 	 * @since 3.9.0
       
  2123 	 *
       
  2124 	 * @returns {void}
  2041 	 */
  2125 	 */
  2042 	deactivate: function() {
  2126 	deactivate: function() {
  2043 		this.frame.off( 'toolbar:render:edit-image' );
  2127 		this.frame.off( 'toolbar:render:edit-image' );
  2044 	},
  2128 	},
  2045 
  2129 
  2046 	/**
  2130 	/**
       
  2131 	 * Adds a toolbar with a back button.
       
  2132 	 *
       
  2133 	 * When the back button is pressed it checks whether there is a previous state.
       
  2134 	 * In case there is a previous state it sets that previous state otherwise it
       
  2135 	 * closes the frame.
       
  2136 	 *
  2047 	 * @since 3.9.0
  2137 	 * @since 3.9.0
       
  2138 	 *
       
  2139 	 * @returns {void}
  2048 	 */
  2140 	 */
  2049 	toolbar: function() {
  2141 	toolbar: function() {
  2050 		var frame = this.frame,
  2142 		var frame = this.frame,
  2051 			lastState = frame.lastState(),
  2143 			lastState = frame.lastState(),
  2052 			previous = lastState && lastState.id;
  2144 			previous = lastState && lastState.id;
  2073 
  2165 
  2074 module.exports = EditImage;
  2166 module.exports = EditImage;
  2075 
  2167 
  2076 
  2168 
  2077 /***/ }),
  2169 /***/ }),
  2078 /* 40 */
  2170 /* 44 */
  2079 /***/ (function(module, exports) {
  2171 /***/ (function(module, exports) {
  2080 
  2172 
  2081 /**
  2173 /**
  2082  * wp.media.controller.MediaLibrary
  2174  * wp.media.controller.MediaLibrary
  2083  *
  2175  *
  2129 
  2221 
  2130 module.exports = MediaLibrary;
  2222 module.exports = MediaLibrary;
  2131 
  2223 
  2132 
  2224 
  2133 /***/ }),
  2225 /***/ }),
  2134 /* 41 */
  2226 /* 45 */
  2135 /***/ (function(module, exports) {
  2227 /***/ (function(module, exports) {
  2136 
  2228 
  2137 var l10n = wp.media.view.l10n,
  2229 var l10n = wp.media.view.l10n,
  2138 	$ = Backbone.$,
  2230 	$ = Backbone.$,
  2139 	Embed;
  2231 	Embed;
  2271 
  2363 
  2272 module.exports = Embed;
  2364 module.exports = Embed;
  2273 
  2365 
  2274 
  2366 
  2275 /***/ }),
  2367 /***/ }),
  2276 /* 42 */
  2368 /* 46 */
  2277 /***/ (function(module, exports) {
  2369 /***/ (function(module, exports) {
  2278 
  2370 
  2279 var l10n = wp.media.view.l10n,
  2371 var l10n = wp.media.view.l10n,
  2280 	Cropper;
  2372 	Cropper;
  2281 
  2373 
  2282 /**
  2374 /**
  2283  * wp.media.controller.Cropper
  2375  * wp.media.controller.Cropper
  2284  *
  2376  *
  2285  * A state for cropping an image.
  2377  * A class for cropping an image when called from the header media customization panel.
  2286  *
  2378  *
  2287  * @memberOf wp.media.controller
  2379  * @memberOf wp.media.controller
  2288  *
  2380  *
  2289  * @class
  2381  * @class
  2290  * @augments wp.media.controller.State
  2382  * @augments wp.media.controller.State
  2302 
  2394 
  2303 		// Default doCrop Ajax arguments to allow the Customizer (for example) to inject state.
  2395 		// Default doCrop Ajax arguments to allow the Customizer (for example) to inject state.
  2304 		doCropArgs: {}
  2396 		doCropArgs: {}
  2305 	},
  2397 	},
  2306 
  2398 
       
  2399 	/**
       
  2400 	 * Shows the crop image window when called from the Add new image button.
       
  2401 	 *
       
  2402 	 * @since 4.2.0
       
  2403 	 *
       
  2404 	 * @returns {void}
       
  2405 	 */
  2307 	activate: function() {
  2406 	activate: function() {
  2308 		this.frame.on( 'content:create:crop', this.createCropContent, this );
  2407 		this.frame.on( 'content:create:crop', this.createCropContent, this );
  2309 		this.frame.on( 'close', this.removeCropper, this );
  2408 		this.frame.on( 'close', this.removeCropper, this );
  2310 		this.set('selection', new Backbone.Collection(this.frame._selection.single));
  2409 		this.set('selection', new Backbone.Collection(this.frame._selection.single));
  2311 	},
  2410 	},
  2312 
  2411 
       
  2412 	/**
       
  2413 	 * Changes the state of the toolbar window to browse mode.
       
  2414 	 *
       
  2415 	 * @since 4.2.0
       
  2416 	 *
       
  2417 	 * @returns {void}
       
  2418 	 */
  2313 	deactivate: function() {
  2419 	deactivate: function() {
  2314 		this.frame.toolbar.mode('browse');
  2420 		this.frame.toolbar.mode('browse');
  2315 	},
  2421 	},
  2316 
  2422 
       
  2423 	/**
       
  2424 	 * Creates the crop image window.
       
  2425 	 *
       
  2426 	 * Initialized when clicking on the Select and Crop button.
       
  2427 	 *
       
  2428 	 * @since 4.2.0
       
  2429 	 *
       
  2430 	 * @fires crop window
       
  2431 	 *
       
  2432 	 * @returns {void}
       
  2433 	 */
  2317 	createCropContent: function() {
  2434 	createCropContent: function() {
  2318 		this.cropperView = new wp.media.view.Cropper({
  2435 		this.cropperView = new wp.media.view.Cropper({
  2319 			controller: this,
  2436 			controller: this,
  2320 			attachment: this.get('selection').first()
  2437 			attachment: this.get('selection').first()
  2321 		});
  2438 		});
  2322 		this.cropperView.on('image-loaded', this.createCropToolbar, this);
  2439 		this.cropperView.on('image-loaded', this.createCropToolbar, this);
  2323 		this.frame.content.set(this.cropperView);
  2440 		this.frame.content.set(this.cropperView);
  2324 
  2441 
  2325 	},
  2442 	},
       
  2443 
       
  2444 	/**
       
  2445 	 * Removes the image selection and closes the cropping window.
       
  2446 	 *
       
  2447 	 * @since 4.2.0
       
  2448 	 *
       
  2449 	 * @returns {void}
       
  2450 	 */
  2326 	removeCropper: function() {
  2451 	removeCropper: function() {
  2327 		this.imgSelect.cancelSelection();
  2452 		this.imgSelect.cancelSelection();
  2328 		this.imgSelect.setOptions({remove: true});
  2453 		this.imgSelect.setOptions({remove: true});
  2329 		this.imgSelect.update();
  2454 		this.imgSelect.update();
  2330 		this.cropperView.remove();
  2455 		this.cropperView.remove();
  2331 	},
  2456 	},
       
  2457 
       
  2458 	/**
       
  2459 	 * Checks if cropping can be skipped and creates crop toolbar accordingly.
       
  2460 	 *
       
  2461 	 * @since 4.2.0
       
  2462 	 *
       
  2463 	 * @returns {void}
       
  2464 	 */
  2332 	createCropToolbar: function() {
  2465 	createCropToolbar: function() {
  2333 		var canSkipCrop, toolbarOptions;
  2466 		var canSkipCrop, toolbarOptions;
  2334 
  2467 
  2335 		canSkipCrop = this.get('canSkipCrop') || false;
  2468 		canSkipCrop = this.get('canSkipCrop') || false;
  2336 
  2469 
  2382 		}
  2515 		}
  2383 
  2516 
  2384 		this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) );
  2517 		this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) );
  2385 	},
  2518 	},
  2386 
  2519 
       
  2520 	/**
       
  2521 	 * Creates an object with the image attachment and crop properties.
       
  2522 	 *
       
  2523 	 * @since 4.2.0
       
  2524 	 *
       
  2525 	 * @returns {$.promise} A jQuery promise with the custom header crop details.
       
  2526 	 */
  2387 	doCrop: function( attachment ) {
  2527 	doCrop: function( attachment ) {
  2388 		return wp.ajax.post( 'custom-header-crop', _.extend(
  2528 		return wp.ajax.post( 'custom-header-crop', _.extend(
  2389 			{},
  2529 			{},
  2390 			this.defaults.doCropArgs,
  2530 			this.defaults.doCropArgs,
  2391 			{
  2531 			{
  2399 
  2539 
  2400 module.exports = Cropper;
  2540 module.exports = Cropper;
  2401 
  2541 
  2402 
  2542 
  2403 /***/ }),
  2543 /***/ }),
  2404 /* 43 */
  2544 /* 47 */
  2405 /***/ (function(module, exports) {
  2545 /***/ (function(module, exports) {
  2406 
  2546 
  2407 var Controller = wp.media.controller,
  2547 var Controller = wp.media.controller,
  2408 	CustomizeImageCropper;
  2548 	CustomizeImageCropper;
  2409 
  2549 
  2410 /**
  2550 /**
  2411  * wp.media.controller.CustomizeImageCropper
  2551  * A state for cropping an image in the customizer.
  2412  *
  2552  *
       
  2553  * @since 4.3.0
       
  2554  *
       
  2555  * @constructs wp.media.controller.CustomizeImageCropper
  2413  * @memberOf wp.media.controller
  2556  * @memberOf wp.media.controller
  2414  *
  2557  * @augments wp.media.controller.CustomizeImageCropper.Cropper
  2415  * A state for cropping an image.
  2558  * @inheritDoc
  2416  *
       
  2417  * @class
       
  2418  * @augments wp.media.controller.Cropper
       
  2419  * @augments wp.media.controller.State
       
  2420  * @augments Backbone.Model
       
  2421  */
  2559  */
  2422 CustomizeImageCropper = Controller.Cropper.extend(/** @lends wp.media.controller.CustomizeImageCropper.prototype */{
  2560 CustomizeImageCropper = Controller.Cropper.extend(/** @lends wp.media.controller.CustomizeImageCropper.prototype */{
       
  2561 	/**
       
  2562 	 * Posts the crop details to the admin.
       
  2563 	 *
       
  2564 	 * Uses crop measurements when flexible in both directions.
       
  2565 	 * Constrains flexible side based on image ratio and size of the fixed side.
       
  2566 	 *
       
  2567 	 * @since 4.3.0
       
  2568 	 *
       
  2569 	 * @param {Object} attachment The attachment to crop.
       
  2570 	 *
       
  2571 	 * @returns {$.promise} A jQuery promise that represents the crop image request.
       
  2572 	 */
  2423 	doCrop: function( attachment ) {
  2573 	doCrop: function( attachment ) {
  2424 		var cropDetails = attachment.get( 'cropDetails' ),
  2574 		var cropDetails = attachment.get( 'cropDetails' ),
  2425 			control = this.get( 'control' ),
  2575 			control = this.get( 'control' ),
  2426 			ratio = cropDetails.width / cropDetails.height;
  2576 			ratio = cropDetails.width / cropDetails.height;
  2427 
  2577 
  2448 
  2598 
  2449 module.exports = CustomizeImageCropper;
  2599 module.exports = CustomizeImageCropper;
  2450 
  2600 
  2451 
  2601 
  2452 /***/ }),
  2602 /***/ }),
  2453 /* 44 */
  2603 /* 48 */
  2454 /***/ (function(module, exports) {
  2604 /***/ (function(module, exports) {
  2455 
  2605 
  2456 var Controller = wp.media.controller,
  2606 var Controller = wp.media.controller,
  2457 	SiteIconCropper;
  2607 	SiteIconCropper;
  2458 
  2608 
  2503 
  2653 
  2504 module.exports = SiteIconCropper;
  2654 module.exports = SiteIconCropper;
  2505 
  2655 
  2506 
  2656 
  2507 /***/ }),
  2657 /***/ }),
  2508 /* 45 */
  2658 /* 49 */
  2509 /***/ (function(module, exports) {
  2659 /***/ (function(module, exports) {
  2510 
  2660 
  2511 /**
  2661 /**
  2512  * wp.media.View
  2662  * wp.media.View
  2513  *
  2663  *
  2575 
  2725 
  2576 module.exports = View;
  2726 module.exports = View;
  2577 
  2727 
  2578 
  2728 
  2579 /***/ }),
  2729 /***/ }),
  2580 /* 46 */
  2730 /* 50 */
  2581 /***/ (function(module, exports) {
  2731 /***/ (function(module, exports) {
  2582 
  2732 
  2583 /**
  2733 /**
  2584  * wp.media.view.Frame
  2734  * wp.media.view.Frame
  2585  *
  2735  *
  2747 
  2897 
  2748 module.exports = Frame;
  2898 module.exports = Frame;
  2749 
  2899 
  2750 
  2900 
  2751 /***/ }),
  2901 /***/ }),
  2752 /* 47 */
  2902 /* 51 */
  2753 /***/ (function(module, exports) {
  2903 /***/ (function(module, exports) {
  2754 
  2904 
  2755 var Frame = wp.media.view.Frame,
  2905 var Frame = wp.media.view.Frame,
  2756 	$ = jQuery,
  2906 	$ = jQuery,
  2757 	MediaFrame;
  2907 	MediaFrame;
  3032 
  3182 
  3033 module.exports = MediaFrame;
  3183 module.exports = MediaFrame;
  3034 
  3184 
  3035 
  3185 
  3036 /***/ }),
  3186 /***/ }),
  3037 /* 48 */
  3187 /* 52 */
  3038 /***/ (function(module, exports) {
  3188 /***/ (function(module, exports) {
  3039 
  3189 
  3040 var MediaFrame = wp.media.view.MediaFrame,
  3190 var MediaFrame = wp.media.view.MediaFrame,
  3041 	l10n = wp.media.view.l10n,
  3191 	l10n = wp.media.view.l10n,
  3042 	Select;
  3192 	Select;
  3208 
  3358 
  3209 module.exports = Select;
  3359 module.exports = Select;
  3210 
  3360 
  3211 
  3361 
  3212 /***/ }),
  3362 /***/ }),
  3213 /* 49 */
  3363 /* 53 */
  3214 /***/ (function(module, exports) {
  3364 /***/ (function(module, exports) {
  3215 
  3365 
  3216 var Select = wp.media.view.MediaFrame.Select,
  3366 var Select = wp.media.view.MediaFrame.Select,
  3217 	Library = wp.media.controller.Library,
  3367 	Library = wp.media.controller.Library,
  3218 	l10n = wp.media.view.l10n,
  3368 	l10n = wp.media.view.l10n,
  3658 			priority: 80,
  3808 			priority: 80,
  3659 			text:     l10n.insertIntoPost,
  3809 			text:     l10n.insertIntoPost,
  3660 			requires: { selection: true },
  3810 			requires: { selection: true },
  3661 
  3811 
  3662 			/**
  3812 			/**
  3663 			 * @callback
  3813 			 * @ignore
       
  3814 			 *
  3664 			 * @fires wp.media.controller.State#insert
  3815 			 * @fires wp.media.controller.State#insert
  3665 			 */
  3816 			 */
  3666 			click: function() {
  3817 			click: function() {
  3667 				var state = controller.state(),
  3818 				var state = controller.state(),
  3668 					selection = state.get('selection');
  3819 					selection = state.get('selection');
  3950 
  4101 
  3951 module.exports = Post;
  4102 module.exports = Post;
  3952 
  4103 
  3953 
  4104 
  3954 /***/ }),
  4105 /***/ }),
  3955 /* 50 */
  4106 /* 54 */
  3956 /***/ (function(module, exports) {
  4107 /***/ (function(module, exports) {
  3957 
  4108 
  3958 var Select = wp.media.view.MediaFrame.Select,
  4109 var Select = wp.media.view.MediaFrame.Select,
  3959 	l10n = wp.media.view.l10n,
  4110 	l10n = wp.media.view.l10n,
  3960 	ImageDetails;
  4111 	ImageDetails;
  4134 
  4285 
  4135 module.exports = ImageDetails;
  4286 module.exports = ImageDetails;
  4136 
  4287 
  4137 
  4288 
  4138 /***/ }),
  4289 /***/ }),
  4139 /* 51 */
  4290 /* 55 */
  4140 /***/ (function(module, exports) {
  4291 /***/ (function(module, exports) {
  4141 
  4292 
  4142 var $ = jQuery,
  4293 var $ = jQuery,
  4143 	Modal;
  4294 	Modal;
  4144 
  4295 
  4165 
  4316 
  4166 	clickedOpenerEl: null,
  4317 	clickedOpenerEl: null,
  4167 
  4318 
  4168 	initialize: function() {
  4319 	initialize: function() {
  4169 		_.defaults( this.options, {
  4320 		_.defaults( this.options, {
  4170 			container: document.body,
  4321 			container:      document.body,
  4171 			title:     '',
  4322 			title:          '',
  4172 			propagate: true
  4323 			propagate:      true,
       
  4324 			hasCloseButton: true
  4173 		});
  4325 		});
  4174 
  4326 
  4175 		this.focusManager = new wp.media.view.FocusManager({
  4327 		this.focusManager = new wp.media.view.FocusManager({
  4176 			el: this.el
  4328 			el: this.el
  4177 		});
  4329 		});
  4179 	/**
  4331 	/**
  4180 	 * @returns {Object}
  4332 	 * @returns {Object}
  4181 	 */
  4333 	 */
  4182 	prepare: function() {
  4334 	prepare: function() {
  4183 		return {
  4335 		return {
  4184 			title: this.options.title
  4336 			title:          this.options.title,
       
  4337 			hasCloseButton: this.options.hasCloseButton
  4185 		};
  4338 		};
  4186 	},
  4339 	},
  4187 
  4340 
  4188 	/**
  4341 	/**
  4189 	 * @returns {wp.media.view.Modal} Returns itself to allow chaining
  4342 	 * @returns {wp.media.view.Modal} Returns itself to allow chaining
  4254 		}
  4407 		}
  4255 
  4408 
  4256 		// Set initial focus on the content instead of this view element, to avoid page scrolling.
  4409 		// Set initial focus on the content instead of this view element, to avoid page scrolling.
  4257 		this.$( '.media-modal' ).focus();
  4410 		this.$( '.media-modal' ).focus();
  4258 
  4411 
       
  4412 		// Hide the page content from assistive technologies.
       
  4413 		this.focusManager.setAriaHiddenOnBodyChildren( $el );
       
  4414 
  4259 		return this.propagate('open');
  4415 		return this.propagate('open');
  4260 	},
  4416 	},
  4261 
  4417 
  4262 	/**
  4418 	/**
  4263 	 * @param {Object} options
  4419 	 * @param {Object} options
  4271 		// Enable page scrolling.
  4427 		// Enable page scrolling.
  4272 		$( 'body' ).removeClass( 'modal-open' );
  4428 		$( 'body' ).removeClass( 'modal-open' );
  4273 
  4429 
  4274 		// Hide modal and remove restricted media modal tab focus once it's closed
  4430 		// Hide modal and remove restricted media modal tab focus once it's closed
  4275 		this.$el.hide().undelegate( 'keydown' );
  4431 		this.$el.hide().undelegate( 'keydown' );
       
  4432 
       
  4433 		/*
       
  4434 		 * Make visible again to assistive technologies all body children that
       
  4435 		 * have been made hidden when the modal opened.
       
  4436 		 */
       
  4437 		this.focusManager.removeAriaHiddenFromBodyChildren();
  4276 
  4438 
  4277 		// Put focus back in useful location once modal is closed.
  4439 		// Put focus back in useful location once modal is closed.
  4278 		if ( null !== this.clickedOpenerEl ) {
  4440 		if ( null !== this.clickedOpenerEl ) {
  4279 			this.clickedOpenerEl.focus();
  4441 			this.clickedOpenerEl.focus();
  4280 		} else {
  4442 		} else {
  4281 			$( '#wpbody-content' ).focus();
  4443 			$( '#wpbody-content' )
       
  4444 				.attr( 'tabindex', '-1' )
       
  4445 				.focus();
  4282 		}
  4446 		}
  4283 
  4447 
  4284 		this.propagate('close');
  4448 		this.propagate('close');
  4285 
  4449 
  4286 		if ( options && options.escape ) {
  4450 		if ( options && options.escape ) {
  4342 
  4506 
  4343 module.exports = Modal;
  4507 module.exports = Modal;
  4344 
  4508 
  4345 
  4509 
  4346 /***/ }),
  4510 /***/ }),
  4347 /* 52 */
  4511 /* 56 */
  4348 /***/ (function(module, exports) {
  4512 /***/ (function(module, exports) {
  4349 
  4513 
  4350 /**
  4514 /**
  4351  * wp.media.view.FocusManager
  4515  * wp.media.view.FocusManager
  4352  *
  4516  *
  4361 
  4525 
  4362 	events: {
  4526 	events: {
  4363 		'keydown': 'constrainTabbing'
  4527 		'keydown': 'constrainTabbing'
  4364 	},
  4528 	},
  4365 
  4529 
  4366 	focus: function() { // Reset focus on first left menu item
  4530 	/**
  4367 		this.$('.media-menu-item').first().focus();
  4531 	 * Moves focus to the first visible menu item in the modal.
  4368 	},
  4532 	 *
  4369 	/**
  4533 	 * @since 3.5.0
  4370 	 * @param {Object} event
  4534 	 *
       
  4535 	 * @returns {void}
       
  4536 	 */
       
  4537 	focus: function() {
       
  4538 		this.$( '.media-menu-item' ).filter( ':visible' ).first().focus();
       
  4539 	},
       
  4540 	/**
       
  4541 	 * Constrains navigation with the Tab key within the media view element.
       
  4542 	 *
       
  4543 	 * @since 4.0.0
       
  4544 	 *
       
  4545 	 * @param {Object} event A keydown jQuery event.
       
  4546 	 *
       
  4547 	 * @returns {void}
  4371 	 */
  4548 	 */
  4372 	constrainTabbing: function( event ) {
  4549 	constrainTabbing: function( event ) {
  4373 		var tabbables;
  4550 		var tabbables;
  4374 
  4551 
  4375 		// Look for the tab key.
  4552 		// Look for the tab key.
  4386 			return false;
  4563 			return false;
  4387 		} else if ( tabbables.first()[0] === event.target && event.shiftKey ) {
  4564 		} else if ( tabbables.first()[0] === event.target && event.shiftKey ) {
  4388 			tabbables.last().focus();
  4565 			tabbables.last().focus();
  4389 			return false;
  4566 			return false;
  4390 		}
  4567 		}
  4391 	}
  4568 	},
  4392 
  4569 
       
  4570 	/**
       
  4571 	 * Hides from assistive technologies all the body children except the
       
  4572 	 * provided element and other elements that should not be hidden.
       
  4573 	 *
       
  4574 	 * The reason why we use `aria-hidden` is that `aria-modal="true"` is buggy
       
  4575 	 * in Safari 11.1 and support is spotty in other browsers. In the future we
       
  4576 	 * should consider to remove this helper function and only use `aria-modal="true"`.
       
  4577 	 *
       
  4578 	 * @since 5.2.3
       
  4579 	 *
       
  4580 	 * @param {object} visibleElement The jQuery object representing the element that should not be hidden.
       
  4581 	 *
       
  4582 	 * @returns {void}
       
  4583 	 */
       
  4584 	setAriaHiddenOnBodyChildren: function( visibleElement ) {
       
  4585 		var bodyChildren,
       
  4586 			self = this;
       
  4587 
       
  4588 		if ( this.isBodyAriaHidden ) {
       
  4589 			return;
       
  4590 		}
       
  4591 
       
  4592 		// Get all the body children.
       
  4593 		bodyChildren = document.body.children;
       
  4594 
       
  4595 		// Loop through the body children and hide the ones that should be hidden.
       
  4596 		_.each( bodyChildren, function( element ) {
       
  4597 			// Don't hide the modal element.
       
  4598 			if ( element === visibleElement[0] ) {
       
  4599 				return;
       
  4600 			}
       
  4601 
       
  4602 			// Determine the body children to hide.
       
  4603 			if ( self.elementShouldBeHidden( element ) ) {
       
  4604 				element.setAttribute( 'aria-hidden', 'true' );
       
  4605 				// Store the hidden elements.
       
  4606 				self.ariaHiddenElements.push( element );
       
  4607 			}
       
  4608 		} );
       
  4609 
       
  4610 		this.isBodyAriaHidden = true;
       
  4611 	},
       
  4612 
       
  4613 	/**
       
  4614 	 * Makes visible again to assistive technologies all body children
       
  4615 	 * previously hidden and stored in this.ariaHiddenElements.
       
  4616 	 *
       
  4617 	 * @since 5.2.3
       
  4618 	 *
       
  4619 	 * @returns {void}
       
  4620 	 */
       
  4621 	removeAriaHiddenFromBodyChildren: function() {
       
  4622 		_.each( this.ariaHiddenElements, function( element ) {
       
  4623 			element.removeAttribute( 'aria-hidden' );
       
  4624 		} );
       
  4625 
       
  4626 		this.ariaHiddenElements = [];
       
  4627 		this.isBodyAriaHidden   = false;
       
  4628 	},
       
  4629 
       
  4630 	/**
       
  4631 	 * Determines if the passed element should not be hidden from assistive technologies.
       
  4632 	 *
       
  4633 	 * @since 5.2.3
       
  4634 	 *
       
  4635 	 * @param {object} element The DOM element that should be checked.
       
  4636 	 *
       
  4637 	 * @returns {boolean} Whether the element should not be hidden from assistive technologies.
       
  4638 	 */
       
  4639 	elementShouldBeHidden: function( element ) {
       
  4640 		var role = element.getAttribute( 'role' ),
       
  4641 			liveRegionsRoles = [ 'alert', 'status', 'log', 'marquee', 'timer' ];
       
  4642 
       
  4643 		/*
       
  4644 		 * Don't hide scripts, elements that already have `aria-hidden`, and
       
  4645 		 * ARIA live regions.
       
  4646 		 */
       
  4647 		return ! (
       
  4648 			element.tagName === 'SCRIPT' ||
       
  4649 			element.hasAttribute( 'aria-hidden' ) ||
       
  4650 			element.hasAttribute( 'aria-live' ) ||
       
  4651 			liveRegionsRoles.indexOf( role ) !== -1
       
  4652 		);
       
  4653 	},
       
  4654 
       
  4655 	/**
       
  4656 	 * Whether the body children are hidden from assistive technologies.
       
  4657 	 *
       
  4658 	 * @since 5.2.3
       
  4659 	 */
       
  4660 	isBodyAriaHidden: false,
       
  4661 
       
  4662 	/**
       
  4663 	 * Stores an array of DOM elements that should be hidden from assistive
       
  4664 	 * technologies, for example when the media modal dialog opens.
       
  4665 	 *
       
  4666 	 * @since 5.2.3
       
  4667 	 */
       
  4668 	ariaHiddenElements: []
  4393 });
  4669 });
  4394 
  4670 
  4395 module.exports = FocusManager;
  4671 module.exports = FocusManager;
  4396 
  4672 
  4397 
  4673 
  4398 /***/ }),
  4674 /***/ }),
  4399 /* 53 */
  4675 /* 57 */
  4400 /***/ (function(module, exports) {
  4676 /***/ (function(module, exports) {
  4401 
  4677 
  4402 var $ = jQuery,
  4678 var $ = jQuery,
  4403 	UploaderWindow;
  4679 	UploaderWindow;
  4404 
  4680 
  4511 
  4787 
  4512 module.exports = UploaderWindow;
  4788 module.exports = UploaderWindow;
  4513 
  4789 
  4514 
  4790 
  4515 /***/ }),
  4791 /***/ }),
  4516 /* 54 */
  4792 /* 58 */
  4517 /***/ (function(module, exports) {
  4793 /***/ (function(module, exports) {
  4518 
  4794 
  4519 var View = wp.media.View,
  4795 var View = wp.media.View,
  4520 	l10n = wp.media.view.l10n,
  4796 	l10n = wp.media.view.l10n,
  4521 	$ = jQuery,
  4797 	$ = jQuery,
  4742 
  5018 
  4743 module.exports = EditorUploader;
  5019 module.exports = EditorUploader;
  4744 
  5020 
  4745 
  5021 
  4746 /***/ }),
  5022 /***/ }),
  4747 /* 55 */
  5023 /* 59 */
  4748 /***/ (function(module, exports) {
  5024 /***/ (function(module, exports) {
  4749 
  5025 
  4750 var View = wp.media.View,
  5026 var View = wp.media.View,
  4751 	UploaderInline;
  5027 	UploaderInline;
  4752 
  5028 
  4888 
  5164 
  4889 module.exports = UploaderInline;
  5165 module.exports = UploaderInline;
  4890 
  5166 
  4891 
  5167 
  4892 /***/ }),
  5168 /***/ }),
  4893 /* 56 */
  5169 /* 60 */
  4894 /***/ (function(module, exports) {
  5170 /***/ (function(module, exports) {
  4895 
  5171 
  4896 var View = wp.media.View,
  5172 var View = wp.media.View,
  4897 	UploaderStatus;
  5173 	UploaderStatus;
  4898 
  5174 
  5010 			filename: this.filename( error.get('file').name ),
  5286 			filename: this.filename( error.get('file').name ),
  5011 			message:  error.get('message')
  5287 			message:  error.get('message')
  5012 		}), { at: 0 });
  5288 		}), { at: 0 });
  5013 	},
  5289 	},
  5014 
  5290 
  5015 	/**
  5291 	dismiss: function() {
  5016 	 * @param {Object} event
       
  5017 	 */
       
  5018 	dismiss: function( event ) {
       
  5019 		var errors = this.views.get('.upload-errors');
  5292 		var errors = this.views.get('.upload-errors');
  5020 
       
  5021 		event.preventDefault();
       
  5022 
  5293 
  5023 		if ( errors ) {
  5294 		if ( errors ) {
  5024 			_.invoke( errors, 'remove' );
  5295 			_.invoke( errors, 'remove' );
  5025 		}
  5296 		}
  5026 		wp.Uploader.errors.reset();
  5297 		wp.Uploader.errors.reset();
       
  5298 		// Keep focus within the modal after the dismiss button gets removed from the DOM.
       
  5299 		this.controller.modal.focusManager.focus();
  5027 	}
  5300 	}
  5028 });
  5301 });
  5029 
  5302 
  5030 module.exports = UploaderStatus;
  5303 module.exports = UploaderStatus;
  5031 
  5304 
  5032 
  5305 
  5033 /***/ }),
  5306 /***/ }),
  5034 /* 57 */
  5307 /* 61 */
  5035 /***/ (function(module, exports) {
  5308 /***/ (function(module, exports) {
  5036 
  5309 
  5037 /**
  5310 /**
  5038  * wp.media.view.UploaderStatusError
  5311  * wp.media.view.UploaderStatusError
  5039  *
  5312  *
  5051 
  5324 
  5052 module.exports = UploaderStatusError;
  5325 module.exports = UploaderStatusError;
  5053 
  5326 
  5054 
  5327 
  5055 /***/ }),
  5328 /***/ }),
  5056 /* 58 */
  5329 /* 62 */
  5057 /***/ (function(module, exports) {
  5330 /***/ (function(module, exports) {
  5058 
  5331 
  5059 var View = wp.media.View,
  5332 var View = wp.media.View,
  5060 	Toolbar;
  5333 	Toolbar;
  5061 
  5334 
  5219 
  5492 
  5220 module.exports = Toolbar;
  5493 module.exports = Toolbar;
  5221 
  5494 
  5222 
  5495 
  5223 /***/ }),
  5496 /***/ }),
  5224 /* 59 */
  5497 /* 63 */
  5225 /***/ (function(module, exports) {
  5498 /***/ (function(module, exports) {
  5226 
  5499 
  5227 var Toolbar = wp.media.view.Toolbar,
  5500 var Toolbar = wp.media.view.Toolbar,
  5228 	l10n = wp.media.view.l10n,
  5501 	l10n = wp.media.view.l10n,
  5229 	Select;
  5502 	Select;
  5295 
  5568 
  5296 module.exports = Select;
  5569 module.exports = Select;
  5297 
  5570 
  5298 
  5571 
  5299 /***/ }),
  5572 /***/ }),
  5300 /* 60 */
  5573 /* 64 */
  5301 /***/ (function(module, exports) {
  5574 /***/ (function(module, exports) {
  5302 
  5575 
  5303 var Select = wp.media.view.Toolbar.Select,
  5576 var Select = wp.media.view.Toolbar.Select,
  5304 	l10n = wp.media.view.l10n,
  5577 	l10n = wp.media.view.l10n,
  5305 	Embed;
  5578 	Embed;
  5338 
  5611 
  5339 module.exports = Embed;
  5612 module.exports = Embed;
  5340 
  5613 
  5341 
  5614 
  5342 /***/ }),
  5615 /***/ }),
  5343 /* 61 */
  5616 /* 65 */
  5344 /***/ (function(module, exports) {
  5617 /***/ (function(module, exports) {
  5345 
  5618 
  5346 /**
  5619 /**
  5347  * wp.media.view.Button
  5620  * wp.media.view.Button
  5348  *
  5621  *
  5430 
  5703 
  5431 module.exports = Button;
  5704 module.exports = Button;
  5432 
  5705 
  5433 
  5706 
  5434 /***/ }),
  5707 /***/ }),
  5435 /* 62 */
  5708 /* 66 */
  5436 /***/ (function(module, exports) {
  5709 /***/ (function(module, exports) {
  5437 
  5710 
  5438 var $ = Backbone.$,
  5711 var $ = Backbone.$,
  5439 	ButtonGroup;
  5712 	ButtonGroup;
  5440 
  5713 
  5482 
  5755 
  5483 module.exports = ButtonGroup;
  5756 module.exports = ButtonGroup;
  5484 
  5757 
  5485 
  5758 
  5486 /***/ }),
  5759 /***/ }),
  5487 /* 63 */
  5760 /* 67 */
  5488 /***/ (function(module, exports) {
  5761 /***/ (function(module, exports) {
  5489 
  5762 
  5490 /**
  5763 /**
  5491  * wp.media.view.PriorityList
  5764  * wp.media.view.PriorityList
  5492  *
  5765  *
  5585 
  5858 
  5586 module.exports = PriorityList;
  5859 module.exports = PriorityList;
  5587 
  5860 
  5588 
  5861 
  5589 /***/ }),
  5862 /***/ }),
  5590 /* 64 */
  5863 /* 68 */
  5591 /***/ (function(module, exports) {
  5864 /***/ (function(module, exports) {
  5592 
  5865 
  5593 var $ = jQuery,
  5866 var $ = jQuery,
  5594 	MenuItem;
  5867 	MenuItem;
  5595 
  5868 
  5663 
  5936 
  5664 module.exports = MenuItem;
  5937 module.exports = MenuItem;
  5665 
  5938 
  5666 
  5939 
  5667 /***/ }),
  5940 /***/ }),
  5668 /* 65 */
  5941 /* 69 */
  5669 /***/ (function(module, exports) {
  5942 /***/ (function(module, exports) {
  5670 
  5943 
  5671 var MenuItem = wp.media.view.MenuItem,
  5944 var MenuItem = wp.media.view.MenuItem,
  5672 	PriorityList = wp.media.view.PriorityList,
  5945 	PriorityList = wp.media.view.PriorityList,
  5673 	Menu;
  5946 	Menu;
  5786 
  6059 
  5787 module.exports = Menu;
  6060 module.exports = Menu;
  5788 
  6061 
  5789 
  6062 
  5790 /***/ }),
  6063 /***/ }),
  5791 /* 66 */
  6064 /* 70 */
  5792 /***/ (function(module, exports) {
  6065 /***/ (function(module, exports) {
  5793 
  6066 
  5794 /**
  6067 /**
  5795  * wp.media.view.RouterItem
  6068  * wp.media.view.RouterItem
  5796  *
  6069  *
  5816 
  6089 
  5817 module.exports = RouterItem;
  6090 module.exports = RouterItem;
  5818 
  6091 
  5819 
  6092 
  5820 /***/ }),
  6093 /***/ }),
  5821 /* 67 */
  6094 /* 71 */
  5822 /***/ (function(module, exports) {
  6095 /***/ (function(module, exports) {
  5823 
  6096 
  5824 var Menu = wp.media.view.Menu,
  6097 var Menu = wp.media.view.Menu,
  5825 	Router;
  6098 	Router;
  5826 
  6099 
  5859 
  6132 
  5860 module.exports = Router;
  6133 module.exports = Router;
  5861 
  6134 
  5862 
  6135 
  5863 /***/ }),
  6136 /***/ }),
  5864 /* 68 */
  6137 /* 72 */
  5865 /***/ (function(module, exports) {
  6138 /***/ (function(module, exports) {
  5866 
  6139 
  5867 /**
  6140 /**
  5868  * wp.media.view.Sidebar
  6141  * wp.media.view.Sidebar
  5869  *
  6142  *
  5881 
  6154 
  5882 module.exports = Sidebar;
  6155 module.exports = Sidebar;
  5883 
  6156 
  5884 
  6157 
  5885 /***/ }),
  6158 /***/ }),
  5886 /* 69 */
  6159 /* 73 */
  5887 /***/ (function(module, exports) {
  6160 /***/ (function(module, exports) {
  5888 
  6161 
  5889 var View = wp.media.View,
  6162 var View = wp.media.View,
  5890 	$ = jQuery,
  6163 	$ = jQuery,
  5891 	Attachment;
  6164 	Attachment;
  6395 			// Move focus back to the attachment tile (from the check).
  6668 			// Move focus back to the attachment tile (from the check).
  6396 			this.$el.focus();
  6669 			this.$el.focus();
  6397 		} else {
  6670 		} else {
  6398 			selection.add( this.model );
  6671 			selection.add( this.model );
  6399 		}
  6672 		}
       
  6673 
       
  6674 		// Trigger an action button update.
       
  6675 		this.controller.trigger( 'selection:toggle' );
  6400 	}
  6676 	}
  6401 });
  6677 });
  6402 
  6678 
  6403 // Ensure settings remain in sync between attachment views.
  6679 // Ensure settings remain in sync between attachment views.
  6404 _.each({
  6680 _.each({
  6464 
  6740 
  6465 module.exports = Attachment;
  6741 module.exports = Attachment;
  6466 
  6742 
  6467 
  6743 
  6468 /***/ }),
  6744 /***/ }),
  6469 /* 70 */
  6745 /* 74 */
  6470 /***/ (function(module, exports) {
  6746 /***/ (function(module, exports) {
  6471 
  6747 
  6472 /**
  6748 /**
  6473  * wp.media.view.Attachment.Library
  6749  * wp.media.view.Attachment.Library
  6474  *
  6750  *
  6488 
  6764 
  6489 module.exports = Library;
  6765 module.exports = Library;
  6490 
  6766 
  6491 
  6767 
  6492 /***/ }),
  6768 /***/ }),
  6493 /* 71 */
  6769 /* 75 */
  6494 /***/ (function(module, exports) {
  6770 /***/ (function(module, exports) {
  6495 
  6771 
  6496 /**
  6772 /**
  6497  * wp.media.view.Attachment.EditLibrary
  6773  * wp.media.view.Attachment.EditLibrary
  6498  *
  6774  *
  6512 
  6788 
  6513 module.exports = EditLibrary;
  6789 module.exports = EditLibrary;
  6514 
  6790 
  6515 
  6791 
  6516 /***/ }),
  6792 /***/ }),
  6517 /* 72 */
  6793 /* 76 */
  6518 /***/ (function(module, exports) {
  6794 /***/ (function(module, exports) {
  6519 
  6795 
  6520 var View = wp.media.View,
  6796 var View = wp.media.View,
  6521 	$ = jQuery,
  6797 	$ = jQuery,
  6522 	Attachments;
  6798 	Attachments;
  6523 
  6799 
  6524 /**
       
  6525  * wp.media.view.Attachments
       
  6526  *
       
  6527  * @memberOf wp.media.view
       
  6528  *
       
  6529  * @class
       
  6530  * @augments wp.media.View
       
  6531  * @augments wp.Backbone.View
       
  6532  * @augments Backbone.View
       
  6533  */
       
  6534 Attachments = View.extend(/** @lends wp.media.view.Attachments.prototype */{
  6800 Attachments = View.extend(/** @lends wp.media.view.Attachments.prototype */{
  6535 	tagName:   'ul',
  6801 	tagName:   'ul',
  6536 	className: 'attachments',
  6802 	className: 'attachments',
  6537 
  6803 
  6538 	attributes: {
  6804 	attributes: {
  6539 		tabIndex: -1
  6805 		tabIndex: -1
  6540 	},
  6806 	},
  6541 
  6807 
       
  6808 	/**
       
  6809 	 * Represents the overview of attachments in the Media Library.
       
  6810 	 *
       
  6811 	 * The constructor binds events to the collection this view represents when
       
  6812 	 * adding or removing attachments or resetting the entire collection.
       
  6813 	 *
       
  6814 	 * @since 3.5.0
       
  6815 	 *
       
  6816 	 * @constructs
       
  6817 	 * @memberof wp.media.view
       
  6818 	 *
       
  6819 	 * @augments wp.media.View
       
  6820 	 *
       
  6821 	 * @listens collection:add
       
  6822 	 * @listens collection:remove
       
  6823 	 * @listens collection:reset
       
  6824 	 * @listens controller:library:selection:add
       
  6825 	 * @listens scrollElement:scroll
       
  6826 	 * @listens this:ready
       
  6827 	 * @listens controller:open
       
  6828 	 */
  6542 	initialize: function() {
  6829 	initialize: function() {
  6543 		this.el.id = _.uniqueId('__attachments-view-');
  6830 		this.el.id = _.uniqueId('__attachments-view-');
  6544 
  6831 
       
  6832 		/**
       
  6833 		 * @param refreshSensitivity The time in milliseconds to throttle the scroll
       
  6834 		 *                           handler.
       
  6835 		 * @param refreshThreshold   The amount of pixels that should be scrolled before
       
  6836 		 *                           loading more attachments from the server.
       
  6837 		 * @param AttachmentView     The view class to be used for models in the
       
  6838 		 *                           collection.
       
  6839 		 * @param sortable           A jQuery sortable options object
       
  6840 		 *                           ( http://api.jqueryui.com/sortable/ ).
       
  6841 		 * @param resize             A boolean indicating whether or not to listen to
       
  6842 		 *                           resize events.
       
  6843 		 * @param idealColumnWidth   The width in pixels which a column should have when
       
  6844 		 *                           calculating the total number of columns.
       
  6845 		 */
  6545 		_.defaults( this.options, {
  6846 		_.defaults( this.options, {
  6546 			refreshSensitivity: wp.media.isTouchDevice ? 300 : 200,
  6847 			refreshSensitivity: wp.media.isTouchDevice ? 300 : 200,
  6547 			refreshThreshold:   3,
  6848 			refreshThreshold:   3,
  6548 			AttachmentView:     wp.media.view.Attachment,
  6849 			AttachmentView:     wp.media.view.Attachment,
  6549 			sortable:           false,
  6850 			sortable:           false,
  6559 			this.views.add( this.createAttachmentView( attachment ), {
  6860 			this.views.add( this.createAttachmentView( attachment ), {
  6560 				at: this.collection.indexOf( attachment )
  6861 				at: this.collection.indexOf( attachment )
  6561 			});
  6862 			});
  6562 		}, this );
  6863 		}, this );
  6563 
  6864 
       
  6865 		/*
       
  6866 		 * Find the view to be removed, delete it and call the remove function to clear
       
  6867 		 * any set event handlers.
       
  6868 		 */
  6564 		this.collection.on( 'remove', function( attachment ) {
  6869 		this.collection.on( 'remove', function( attachment ) {
  6565 			var view = this._viewsByCid[ attachment.cid ];
  6870 			var view = this._viewsByCid[ attachment.cid ];
  6566 			delete this._viewsByCid[ attachment.cid ];
  6871 			delete this._viewsByCid[ attachment.cid ];
  6567 
  6872 
  6568 			if ( view ) {
  6873 			if ( view ) {
  6586 
  6891 
  6587 		if ( this.options.resize ) {
  6892 		if ( this.options.resize ) {
  6588 			this.on( 'ready', this.bindEvents );
  6893 			this.on( 'ready', this.bindEvents );
  6589 			this.controller.on( 'open', this.setColumns );
  6894 			this.controller.on( 'open', this.setColumns );
  6590 
  6895 
  6591 			// Call this.setColumns() after this view has been rendered in the DOM so
  6896 			/*
  6592 			// attachments get proper width applied.
  6897 			 * Call this.setColumns() after this view has been rendered in the
       
  6898 			 * DOM so attachments get proper width applied.
       
  6899 			 */
  6593 			_.defer( this.setColumns, this );
  6900 			_.defer( this.setColumns, this );
  6594 		}
  6901 		}
  6595 	},
  6902 	},
  6596 
  6903 
       
  6904 	/**
       
  6905 	 * Listens to the resizeEvent on the window.
       
  6906 	 *
       
  6907 	 * Adjusts the amount of columns accordingly. First removes any existing event
       
  6908 	 * handlers to prevent duplicate listeners.
       
  6909 	 *
       
  6910 	 * @since 4.0.0
       
  6911 	 *
       
  6912 	 * @listens window:resize
       
  6913 	 *
       
  6914 	 * @returns {void}
       
  6915 	 */
  6597 	bindEvents: function() {
  6916 	bindEvents: function() {
  6598 		this.$window.off( this.resizeEvent ).on( this.resizeEvent, _.debounce( this.setColumns, 50 ) );
  6917 		this.$window.off( this.resizeEvent ).on( this.resizeEvent, _.debounce( this.setColumns, 50 ) );
  6599 	},
  6918 	},
  6600 
  6919 
       
  6920 	/**
       
  6921 	 * Focuses the first item in the collection.
       
  6922 	 *
       
  6923 	 * @since 4.0.0
       
  6924 	 *
       
  6925 	 * @returns {void}
       
  6926 	 */
  6601 	attachmentFocus: function() {
  6927 	attachmentFocus: function() {
  6602 		this.$( 'li:first' ).focus();
  6928 		this.$( 'li:first' ).focus();
  6603 	},
  6929 	},
  6604 
  6930 
       
  6931 	/**
       
  6932 	 * Restores focus to the selected item in the collection.
       
  6933 	 *
       
  6934 	 * @since 4.0.0
       
  6935 	 *
       
  6936 	 * @returns {void}
       
  6937 	 */
  6605 	restoreFocus: function() {
  6938 	restoreFocus: function() {
  6606 		this.$( 'li.selected:first' ).focus();
  6939 		this.$( 'li.selected:first' ).focus();
  6607 	},
  6940 	},
  6608 
  6941 
       
  6942 	/**
       
  6943 	 * Handles events for arrow key presses.
       
  6944 	 *
       
  6945 	 * Focuses the attachment in the direction of the used arrow key if it exists.
       
  6946 	 *
       
  6947 	 * @since 4.0.0
       
  6948 	 *
       
  6949 	 * @param {KeyboardEvent} event The keyboard event that triggered this function.
       
  6950 	 *
       
  6951 	 * @returns {void}
       
  6952 	 */
  6609 	arrowEvent: function( event ) {
  6953 	arrowEvent: function( event ) {
  6610 		var attachments = this.$el.children( 'li' ),
  6954 		var attachments = this.$el.children( 'li' ),
  6611 			perRow = this.columns,
  6955 			perRow = this.columns,
  6612 			index = attachments.filter( ':focus' ).index(),
  6956 			index = attachments.filter( ':focus' ).index(),
  6613 			row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow );
  6957 			row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow );
  6614 
  6958 
  6615 		if ( index === -1 ) {
  6959 		if ( index === -1 ) {
  6616 			return;
  6960 			return;
  6617 		}
  6961 		}
  6618 
  6962 
  6619 		// Left arrow
  6963 		// Left arrow = 37.
  6620 		if ( 37 === event.keyCode ) {
  6964 		if ( 37 === event.keyCode ) {
  6621 			if ( 0 === index ) {
  6965 			if ( 0 === index ) {
  6622 				return;
  6966 				return;
  6623 			}
  6967 			}
  6624 			attachments.eq( index - 1 ).focus();
  6968 			attachments.eq( index - 1 ).focus();
  6625 		}
  6969 		}
  6626 
  6970 
  6627 		// Up arrow
  6971 		// Up arrow = 38.
  6628 		if ( 38 === event.keyCode ) {
  6972 		if ( 38 === event.keyCode ) {
  6629 			if ( 1 === row ) {
  6973 			if ( 1 === row ) {
  6630 				return;
  6974 				return;
  6631 			}
  6975 			}
  6632 			attachments.eq( index - perRow ).focus();
  6976 			attachments.eq( index - perRow ).focus();
  6633 		}
  6977 		}
  6634 
  6978 
  6635 		// Right arrow
  6979 		// Right arrow = 39.
  6636 		if ( 39 === event.keyCode ) {
  6980 		if ( 39 === event.keyCode ) {
  6637 			if ( attachments.length === index ) {
  6981 			if ( attachments.length === index ) {
  6638 				return;
  6982 				return;
  6639 			}
  6983 			}
  6640 			attachments.eq( index + 1 ).focus();
  6984 			attachments.eq( index + 1 ).focus();
  6641 		}
  6985 		}
  6642 
  6986 
  6643 		// Down arrow
  6987 		// Down arrow = 40.
  6644 		if ( 40 === event.keyCode ) {
  6988 		if ( 40 === event.keyCode ) {
  6645 			if ( Math.ceil( attachments.length / perRow ) === row ) {
  6989 			if ( Math.ceil( attachments.length / perRow ) === row ) {
  6646 				return;
  6990 				return;
  6647 			}
  6991 			}
  6648 			attachments.eq( index + perRow ).focus();
  6992 			attachments.eq( index + perRow ).focus();
  6649 		}
  6993 		}
  6650 	},
  6994 	},
  6651 
  6995 
       
  6996 	/**
       
  6997 	 * Clears any set event handlers.
       
  6998 	 *
       
  6999 	 * @since 3.5.0
       
  7000 	 *
       
  7001 	 * @returns {void}
       
  7002 	 */
  6652 	dispose: function() {
  7003 	dispose: function() {
  6653 		this.collection.props.off( null, null, this );
  7004 		this.collection.props.off( null, null, this );
  6654 		if ( this.options.resize ) {
  7005 		if ( this.options.resize ) {
  6655 			this.$window.off( this.resizeEvent );
  7006 			this.$window.off( this.resizeEvent );
  6656 		}
  7007 		}
  6657 
  7008 
  6658 		/**
  7009 		// Call 'dispose' directly on the parent class.
  6659 		 * call 'dispose' directly on the parent class
       
  6660 		 */
       
  6661 		View.prototype.dispose.apply( this, arguments );
  7010 		View.prototype.dispose.apply( this, arguments );
  6662 	},
  7011 	},
  6663 
  7012 
       
  7013 	/**
       
  7014 	 * Calculates the amount of columns.
       
  7015 	 *
       
  7016 	 * Calculates the amount of columns and sets it on the data-columns attribute
       
  7017 	 * of .media-frame-content.
       
  7018 	 *
       
  7019 	 * @since 4.0.0
       
  7020 	 *
       
  7021 	 * @returns {void}
       
  7022 	 */
  6664 	setColumns: function() {
  7023 	setColumns: function() {
  6665 		var prev = this.columns,
  7024 		var prev = this.columns,
  6666 			width = this.$el.width();
  7025 			width = this.$el.width();
  6667 
  7026 
  6668 		if ( width ) {
  7027 		if ( width ) {
  6672 				this.$el.closest( '.media-frame-content' ).attr( 'data-columns', this.columns );
  7031 				this.$el.closest( '.media-frame-content' ).attr( 'data-columns', this.columns );
  6673 			}
  7032 			}
  6674 		}
  7033 		}
  6675 	},
  7034 	},
  6676 
  7035 
       
  7036 	/**
       
  7037 	 * Initializes jQuery sortable on the attachment list.
       
  7038 	 *
       
  7039 	 * Fails gracefully if jQuery sortable doesn't exist or isn't passed in the
       
  7040 	 * options.
       
  7041 	 *
       
  7042 	 * @since 3.5.0
       
  7043 	 *
       
  7044 	 * @fires collection:reset
       
  7045 	 *
       
  7046 	 * @returns {void}
       
  7047 	 */
  6677 	initSortable: function() {
  7048 	initSortable: function() {
  6678 		var collection = this.collection;
  7049 		var collection = this.collection;
  6679 
  7050 
  6680 		if ( ! this.options.sortable || ! $.fn.sortable ) {
  7051 		if ( ! this.options.sortable || ! $.fn.sortable ) {
  6681 			return;
  7052 			return;
  6683 
  7054 
  6684 		this.$el.sortable( _.extend({
  7055 		this.$el.sortable( _.extend({
  6685 			// If the `collection` has a `comparator`, disable sorting.
  7056 			// If the `collection` has a `comparator`, disable sorting.
  6686 			disabled: !! collection.comparator,
  7057 			disabled: !! collection.comparator,
  6687 
  7058 
  6688 			// Change the position of the attachment as soon as the
  7059 			/*
  6689 			// mouse pointer overlaps a thumbnail.
  7060 			 * Change the position of the attachment as soon as the mouse pointer overlaps a
       
  7061 			 * thumbnail.
       
  7062 			 */
  6690 			tolerance: 'pointer',
  7063 			tolerance: 'pointer',
  6691 
  7064 
  6692 			// Record the initial `index` of the dragged model.
  7065 			// Record the initial `index` of the dragged model.
  6693 			start: function( event, ui ) {
  7066 			start: function( event, ui ) {
  6694 				ui.item.data('sortableIndexStart', ui.item.index());
  7067 				ui.item.data('sortableIndexStart', ui.item.index());
  6695 			},
  7068 			},
  6696 
  7069 
  6697 			// Update the model's index in the collection.
  7070 			/*
  6698 			// Do so silently, as the view is already accurate.
  7071 			 * Update the model's index in the collection. Do so silently, as the view
       
  7072 			 * is already accurate.
       
  7073 			 */
  6699 			update: function( event, ui ) {
  7074 			update: function( event, ui ) {
  6700 				var model = collection.at( ui.item.data('sortableIndexStart') ),
  7075 				var model = collection.at( ui.item.data('sortableIndexStart') ),
  6701 					comparator = collection.comparator;
  7076 					comparator = collection.comparator;
  6702 
  7077 
  6703 				// Temporarily disable the comparator to prevent `add`
  7078 				// Temporarily disable the comparator to prevent `add`
  6717 				collection.comparator = comparator;
  7092 				collection.comparator = comparator;
  6718 
  7093 
  6719 				// Fire the `reset` event to ensure other collections sync.
  7094 				// Fire the `reset` event to ensure other collections sync.
  6720 				collection.trigger( 'reset', collection );
  7095 				collection.trigger( 'reset', collection );
  6721 
  7096 
  6722 				// If the collection is sorted by menu order,
  7097 				// If the collection is sorted by menu order, update the menu order.
  6723 				// update the menu order.
       
  6724 				collection.saveMenuOrder();
  7098 				collection.saveMenuOrder();
  6725 			}
  7099 			}
  6726 		}, this.options.sortable ) );
  7100 		}, this.options.sortable ) );
  6727 
  7101 
  6728 		// If the `orderby` property is changed on the `collection`,
  7102 		/*
  6729 		// check to see if we have a `comparator`. If so, disable sorting.
  7103 		 * If the `orderby` property is changed on the `collection`, check to see if we
       
  7104 		 * have a `comparator`. If so, disable sorting.
       
  7105 		 */
  6730 		collection.props.on( 'change:orderby', function() {
  7106 		collection.props.on( 'change:orderby', function() {
  6731 			this.$el.sortable( 'option', 'disabled', !! collection.comparator );
  7107 			this.$el.sortable( 'option', 'disabled', !! collection.comparator );
  6732 		}, this );
  7108 		}, this );
  6733 
  7109 
  6734 		this.collection.props.on( 'change:orderby', this.refreshSortable, this );
  7110 		this.collection.props.on( 'change:orderby', this.refreshSortable, this );
  6735 		this.refreshSortable();
  7111 		this.refreshSortable();
  6736 	},
  7112 	},
  6737 
  7113 
       
  7114 	/**
       
  7115 	 * Disables jQuery sortable if collection has a comparator or collection.orderby
       
  7116 	 * equals menuOrder.
       
  7117 	 *
       
  7118 	 * @since 3.5.0
       
  7119 	 *
       
  7120 	 * @returns {void}
       
  7121 	 */
  6738 	refreshSortable: function() {
  7122 	refreshSortable: function() {
  6739 		if ( ! this.options.sortable || ! $.fn.sortable ) {
  7123 		if ( ! this.options.sortable || ! $.fn.sortable ) {
  6740 			return;
  7124 			return;
  6741 		}
  7125 		}
  6742 
  7126 
  6743 		// If the `collection` has a `comparator`, disable sorting.
       
  6744 		var collection = this.collection,
  7127 		var collection = this.collection,
  6745 			orderby = collection.props.get('orderby'),
  7128 			orderby = collection.props.get('orderby'),
  6746 			enabled = 'menuOrder' === orderby || ! collection.comparator;
  7129 			enabled = 'menuOrder' === orderby || ! collection.comparator;
  6747 
  7130 
  6748 		this.$el.sortable( 'option', 'disabled', ! enabled );
  7131 		this.$el.sortable( 'option', 'disabled', ! enabled );
  6749 	},
  7132 	},
  6750 
  7133 
  6751 	/**
  7134 	/**
       
  7135 	 * Creates a new view for an attachment and adds it to _viewsByCid.
       
  7136 	 *
       
  7137 	 * @since 3.5.0
       
  7138 	 *
  6752 	 * @param {wp.media.model.Attachment} attachment
  7139 	 * @param {wp.media.model.Attachment} attachment
  6753 	 * @returns {wp.media.View}
  7140 	 *
       
  7141 	 * @returns {wp.media.View} The created view.
  6754 	 */
  7142 	 */
  6755 	createAttachmentView: function( attachment ) {
  7143 	createAttachmentView: function( attachment ) {
  6756 		var view = new this.options.AttachmentView({
  7144 		var view = new this.options.AttachmentView({
  6757 			controller:           this.controller,
  7145 			controller:           this.controller,
  6758 			model:                attachment,
  7146 			model:                attachment,
  6761 		});
  7149 		});
  6762 
  7150 
  6763 		return this._viewsByCid[ attachment.cid ] = view;
  7151 		return this._viewsByCid[ attachment.cid ] = view;
  6764 	},
  7152 	},
  6765 
  7153 
       
  7154 	/**
       
  7155 	 * Prepares view for display.
       
  7156 	 *
       
  7157 	 * Creates views for every attachment in collection if the collection is not
       
  7158 	 * empty, otherwise clears all views and loads more attachments.
       
  7159 	 *
       
  7160 	 * @since 3.5.0
       
  7161 	 *
       
  7162 	 * @returns {void}
       
  7163 	 */
  6766 	prepare: function() {
  7164 	prepare: function() {
  6767 		// Create all of the Attachment views, and replace
       
  6768 		// the list in a single DOM operation.
       
  6769 		if ( this.collection.length ) {
  7165 		if ( this.collection.length ) {
  6770 			this.views.set( this.collection.map( this.createAttachmentView, this ) );
  7166 			this.views.set( this.collection.map( this.createAttachmentView, this ) );
  6771 
       
  6772 		// If there are no elements, clear the views and load some.
       
  6773 		} else {
  7167 		} else {
  6774 			this.views.unset();
  7168 			this.views.unset();
  6775 			this.collection.more().done( this.scroll );
  7169 			this.collection.more().done( this.scroll );
  6776 		}
  7170 		}
  6777 	},
  7171 	},
  6778 
  7172 
       
  7173 	/**
       
  7174 	 * Triggers the scroll function to check if we should query for additional
       
  7175 	 * attachments right away.
       
  7176 	 *
       
  7177 	 * @since 3.5.0
       
  7178 	 *
       
  7179 	 * @returns {void}
       
  7180 	 */
  6779 	ready: function() {
  7181 	ready: function() {
  6780 		// Trigger the scroll event to check if we're within the
       
  6781 		// threshold to query for additional attachments.
       
  6782 		this.scroll();
  7182 		this.scroll();
  6783 	},
  7183 	},
  6784 
  7184 
       
  7185 	/**
       
  7186 	 * Handles scroll events.
       
  7187 	 *
       
  7188 	 * Shows the spinner if we're close to the bottom. Loads more attachments from
       
  7189 	 * server if we're {refreshThreshold} times away from the bottom.
       
  7190 	 *
       
  7191 	 * @since 3.5.0
       
  7192 	 *
       
  7193 	 * @returns {void}
       
  7194 	 */
  6785 	scroll: function() {
  7195 	scroll: function() {
  6786 		var view = this,
  7196 		var view = this,
  6787 			el = this.options.scrollElement,
  7197 			el = this.options.scrollElement,
  6788 			scrollTop = el.scrollTop,
  7198 			scrollTop = el.scrollTop,
  6789 			toolbar;
  7199 			toolbar;
  6790 
  7200 
  6791 		// The scroll event occurs on the document, but the element
  7201 		/*
  6792 		// that should be checked is the document body.
  7202 		 * The scroll event occurs on the document, but the element that should be
       
  7203 		 * checked is the document body.
       
  7204 		 */
  6793 		if ( el === document ) {
  7205 		if ( el === document ) {
  6794 			el = document.body;
  7206 			el = document.body;
  6795 			scrollTop = $(document).scrollTop();
  7207 			scrollTop = $(document).scrollTop();
  6796 		}
  7208 		}
  6797 
  7209 
  6817 
  7229 
  6818 module.exports = Attachments;
  7230 module.exports = Attachments;
  6819 
  7231 
  6820 
  7232 
  6821 /***/ }),
  7233 /***/ }),
  6822 /* 73 */
  7234 /* 77 */
  6823 /***/ (function(module, exports) {
  7235 /***/ (function(module, exports) {
  6824 
  7236 
  6825 var l10n = wp.media.view.l10n,
  7237 var l10n = wp.media.view.l10n,
  6826 	Search;
  7238 	Search;
  6827 
  7239 
  6869 
  7281 
  6870 module.exports = Search;
  7282 module.exports = Search;
  6871 
  7283 
  6872 
  7284 
  6873 /***/ }),
  7285 /***/ }),
  6874 /* 74 */
  7286 /* 78 */
  6875 /***/ (function(module, exports) {
  7287 /***/ (function(module, exports) {
  6876 
  7288 
  6877 var $ = jQuery,
  7289 var $ = jQuery,
  6878 	AttachmentFilters;
  7290 	AttachmentFilters;
  6879 
  7291 
  6952 
  7364 
  6953 module.exports = AttachmentFilters;
  7365 module.exports = AttachmentFilters;
  6954 
  7366 
  6955 
  7367 
  6956 /***/ }),
  7368 /***/ }),
  6957 /* 75 */
  7369 /* 79 */
  6958 /***/ (function(module, exports) {
  7370 /***/ (function(module, exports) {
  6959 
  7371 
  6960 var l10n = wp.media.view.l10n,
  7372 var l10n = wp.media.view.l10n,
  6961 	DateFilter;
  7373 	DateFilter;
  6962 
  7374 
  6999 
  7411 
  7000 module.exports = DateFilter;
  7412 module.exports = DateFilter;
  7001 
  7413 
  7002 
  7414 
  7003 /***/ }),
  7415 /***/ }),
  7004 /* 76 */
  7416 /* 80 */
  7005 /***/ (function(module, exports) {
  7417 /***/ (function(module, exports) {
  7006 
  7418 
  7007 var l10n = wp.media.view.l10n,
  7419 var l10n = wp.media.view.l10n,
  7008 	Uploaded;
  7420 	Uploaded;
  7009 
  7421 
  7080 
  7492 
  7081 module.exports = Uploaded;
  7493 module.exports = Uploaded;
  7082 
  7494 
  7083 
  7495 
  7084 /***/ }),
  7496 /***/ }),
  7085 /* 77 */
  7497 /* 81 */
  7086 /***/ (function(module, exports) {
  7498 /***/ (function(module, exports) {
  7087 
  7499 
  7088 var l10n = wp.media.view.l10n,
  7500 var l10n = wp.media.view.l10n,
  7089 	All;
  7501 	All;
  7090 
  7502 
  7197 
  7609 
  7198 module.exports = All;
  7610 module.exports = All;
  7199 
  7611 
  7200 
  7612 
  7201 /***/ }),
  7613 /***/ }),
  7202 /* 78 */
  7614 /* 82 */
  7203 /***/ (function(module, exports) {
  7615 /***/ (function(module, exports) {
  7204 
  7616 
  7205 var View = wp.media.View,
  7617 var View = wp.media.View,
  7206 	mediaTrash = wp.media.view.settings.mediaTrash,
  7618 	mediaTrash = wp.media.view.settings.mediaTrash,
  7207 	l10n = wp.media.view.l10n,
  7619 	l10n = wp.media.view.l10n,
  7263 		 * and also for other things, for example the "Drag and drop to reorder" and
  7675 		 * and also for other things, for example the "Drag and drop to reorder" and
  7264 		 * "Suggested dimensions" info in the media modal.
  7676 		 * "Suggested dimensions" info in the media modal.
  7265 		 */
  7677 		 */
  7266 		this.createToolbar();
  7678 		this.createToolbar();
  7267 
  7679 
       
  7680 		// Add a heading before the attachments list.
       
  7681 		this.createAttachmentsHeading();
       
  7682 
  7268 		// Create the list of attachments.
  7683 		// Create the list of attachments.
  7269 		this.createAttachments();
  7684 		this.createAttachments();
  7270 
  7685 
  7271 		// For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909.
  7686 		// For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909.
  7272 		if ( this.options.sidebar && 'errors' !== this.options.sidebar ) {
  7687 		if ( this.options.sidebar && 'errors' !== this.options.sidebar ) {
  7386 
  7801 
  7387 			this.toolbar.set( 'deleteSelectedButton', new wp.media.view.DeleteSelectedButton({
  7802 			this.toolbar.set( 'deleteSelectedButton', new wp.media.view.DeleteSelectedButton({
  7388 				filters: Filters,
  7803 				filters: Filters,
  7389 				style: 'primary',
  7804 				style: 'primary',
  7390 				disabled: true,
  7805 				disabled: true,
  7391 				text: mediaTrash ? l10n.trashSelected : l10n.deleteSelected,
  7806 				text: mediaTrash ? l10n.trashSelected : l10n.deletePermanently,
  7392 				controller: this.controller,
  7807 				controller: this.controller,
  7393 				priority: -60,
  7808 				priority: -80,
  7394 				click: function() {
  7809 				click: function() {
  7395 					var changed = [], removed = [],
  7810 					var changed = [], removed = [],
  7396 						selection = this.controller.state().get( 'selection' ),
  7811 						selection = this.controller.state().get( 'selection' ),
  7397 						library = this.controller.state().get( 'library' );
  7812 						library = this.controller.state().get( 'library' );
  7398 
  7813 
  7444 			}).render() );
  7859 			}).render() );
  7445 
  7860 
  7446 			if ( mediaTrash ) {
  7861 			if ( mediaTrash ) {
  7447 				this.toolbar.set( 'deleteSelectedPermanentlyButton', new wp.media.view.DeleteSelectedPermanentlyButton({
  7862 				this.toolbar.set( 'deleteSelectedPermanentlyButton', new wp.media.view.DeleteSelectedPermanentlyButton({
  7448 					filters: Filters,
  7863 					filters: Filters,
  7449 					style: 'primary',
  7864 					style: 'link button-link-delete',
  7450 					disabled: true,
  7865 					disabled: true,
  7451 					text: l10n.deleteSelected,
  7866 					text: l10n.deletePermanently,
  7452 					controller: this.controller,
  7867 					controller: this.controller,
  7453 					priority: -55,
  7868 					priority: -55,
  7454 					click: function() {
  7869 					click: function() {
  7455 						var removed = [],
  7870 						var removed = [],
  7456 							destroy = [],
  7871 							destroy = [],
  7609 
  8024 
  7610 			this.views.add( this.attachmentsNoResults );
  8025 			this.views.add( this.attachmentsNoResults );
  7611 		}
  8026 		}
  7612 	},
  8027 	},
  7613 
  8028 
       
  8029 	createAttachmentsHeading: function() {
       
  8030 		this.attachmentsHeading = new wp.media.view.Heading( {
       
  8031 			text: l10n.attachmentsList,
       
  8032 			level: 'h2',
       
  8033 			className: 'media-views-heading screen-reader-text'
       
  8034 		} );
       
  8035 		this.views.add( this.attachmentsHeading );
       
  8036 	},
       
  8037 
  7614 	createSidebar: function() {
  8038 	createSidebar: function() {
  7615 		var options = this.options,
  8039 		var options = this.options,
  7616 			selection = options.selection,
  8040 			selection = options.selection,
  7617 			sidebar = this.sidebar = new wp.media.view.Sidebar({
  8041 			sidebar = this.sidebar = new wp.media.view.Sidebar({
  7618 				controller: this.controller
  8042 				controller: this.controller
  7679 
  8103 
  7680 module.exports = AttachmentsBrowser;
  8104 module.exports = AttachmentsBrowser;
  7681 
  8105 
  7682 
  8106 
  7683 /***/ }),
  8107 /***/ }),
  7684 /* 79 */
  8108 /* 83 */
  7685 /***/ (function(module, exports) {
  8109 /***/ (function(module, exports) {
  7686 
  8110 
  7687 var l10n = wp.media.view.l10n,
  8111 var l10n = wp.media.view.l10n,
  7688 	Selection;
  8112 	Selection;
  7689 
  8113 
  7768 
  8192 
  7769 module.exports = Selection;
  8193 module.exports = Selection;
  7770 
  8194 
  7771 
  8195 
  7772 /***/ }),
  8196 /***/ }),
  7773 /* 80 */
  8197 /* 84 */
  7774 /***/ (function(module, exports) {
  8198 /***/ (function(module, exports) {
  7775 
  8199 
  7776 /**
  8200 /**
  7777  * wp.media.view.Attachment.Selection
  8201  * wp.media.view.Attachment.Selection
  7778  *
  8202  *
  7796 
  8220 
  7797 module.exports = Selection;
  8221 module.exports = Selection;
  7798 
  8222 
  7799 
  8223 
  7800 /***/ }),
  8224 /***/ }),
  7801 /* 81 */
  8225 /* 85 */
  7802 /***/ (function(module, exports) {
  8226 /***/ (function(module, exports) {
  7803 
  8227 
  7804 var Attachments = wp.media.view.Attachments,
  8228 var Attachments = wp.media.view.Attachments,
  7805 	Selection;
  8229 	Selection;
  7806 
  8230 
  7832 
  8256 
  7833 module.exports = Selection;
  8257 module.exports = Selection;
  7834 
  8258 
  7835 
  8259 
  7836 /***/ }),
  8260 /***/ }),
  7837 /* 82 */
  8261 /* 86 */
  7838 /***/ (function(module, exports) {
  8262 /***/ (function(module, exports) {
  7839 
  8263 
  7840 /**
  8264 /**
  7841  * wp.media.view.Attachment.EditSelection
  8265  * wp.media.view.Attachment.EditSelection
  7842  *
  8266  *
  7857 
  8281 
  7858 module.exports = EditSelection;
  8282 module.exports = EditSelection;
  7859 
  8283 
  7860 
  8284 
  7861 /***/ }),
  8285 /***/ }),
  7862 /* 83 */
  8286 /* 87 */
  7863 /***/ (function(module, exports) {
  8287 /***/ (function(module, exports) {
  7864 
  8288 
  7865 var View = wp.media.View,
  8289 var View = wp.media.View,
  7866 	$ = Backbone.$,
  8290 	$ = Backbone.$,
  7867 	Settings;
  8291 	Settings;
  7984 
  8408 
  7985 module.exports = Settings;
  8409 module.exports = Settings;
  7986 
  8410 
  7987 
  8411 
  7988 /***/ }),
  8412 /***/ }),
  7989 /* 84 */
  8413 /* 88 */
  7990 /***/ (function(module, exports) {
  8414 /***/ (function(module, exports) {
  7991 
  8415 
  7992 var Settings = wp.media.view.Settings,
  8416 var Settings = wp.media.view.Settings,
  7993 	AttachmentDisplay;
  8417 	AttachmentDisplay;
  7994 
  8418 
  8084 
  8508 
  8085 module.exports = AttachmentDisplay;
  8509 module.exports = AttachmentDisplay;
  8086 
  8510 
  8087 
  8511 
  8088 /***/ }),
  8512 /***/ }),
  8089 /* 85 */
  8513 /* 89 */
  8090 /***/ (function(module, exports) {
  8514 /***/ (function(module, exports) {
  8091 
  8515 
  8092 /**
  8516 /**
  8093  * wp.media.view.Settings.Gallery
  8517  * wp.media.view.Settings.Gallery
  8094  *
  8518  *
  8107 
  8531 
  8108 module.exports = Gallery;
  8532 module.exports = Gallery;
  8109 
  8533 
  8110 
  8534 
  8111 /***/ }),
  8535 /***/ }),
  8112 /* 86 */
  8536 /* 90 */
  8113 /***/ (function(module, exports) {
  8537 /***/ (function(module, exports) {
  8114 
  8538 
  8115 /**
  8539 /**
  8116  * wp.media.view.Settings.Playlist
  8540  * wp.media.view.Settings.Playlist
  8117  *
  8541  *
  8130 
  8554 
  8131 module.exports = Playlist;
  8555 module.exports = Playlist;
  8132 
  8556 
  8133 
  8557 
  8134 /***/ }),
  8558 /***/ }),
  8135 /* 87 */
  8559 /* 91 */
  8136 /***/ (function(module, exports) {
  8560 /***/ (function(module, exports) {
  8137 
  8561 
  8138 var Attachment = wp.media.view.Attachment,
  8562 var Attachment = wp.media.view.Attachment,
  8139 	l10n = wp.media.view.l10n,
  8563 	l10n = wp.media.view.l10n,
  8140 	Details;
  8564 	Details;
  8153 Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototype */{
  8577 Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototype */{
  8154 	tagName:   'div',
  8578 	tagName:   'div',
  8155 	className: 'attachment-details',
  8579 	className: 'attachment-details',
  8156 	template:  wp.template('attachment-details'),
  8580 	template:  wp.template('attachment-details'),
  8157 
  8581 
  8158 	attributes: function() {
  8582 	/*
  8159 		return {
  8583 	 * Reset all the attributes inherited from Attachment including role=checkbox,
  8160 			'tabIndex':     0,
  8584 	 * tabindex, etc., as they are inappropriate for this view. See #47458 and [30483] / #30390.
  8161 			'data-id':      this.model.get( 'id' )
  8585 	 */
  8162 		};
  8586 	attributes: {},
  8163 	},
       
  8164 
  8587 
  8165 	events: {
  8588 	events: {
  8166 		'change [data-setting]':          'updateSetting',
  8589 		'change [data-setting]':          'updateSetting',
  8167 		'change [data-setting] input':    'updateSetting',
  8590 		'change [data-setting] input':    'updateSetting',
  8168 		'change [data-setting] select':   'updateSetting',
  8591 		'change [data-setting] select':   'updateSetting',
  8177 	initialize: function() {
  8600 	initialize: function() {
  8178 		this.options = _.defaults( this.options, {
  8601 		this.options = _.defaults( this.options, {
  8179 			rerenderOnModelChange: false
  8602 			rerenderOnModelChange: false
  8180 		});
  8603 		});
  8181 
  8604 
  8182 		this.on( 'ready', this.initialFocus );
       
  8183 		// Call 'initialize' directly on the parent class.
  8605 		// Call 'initialize' directly on the parent class.
  8184 		Attachment.prototype.initialize.apply( this, arguments );
  8606 		Attachment.prototype.initialize.apply( this, arguments );
  8185 	},
  8607 	},
  8186 
  8608 
  8187 	initialFocus: function() {
       
  8188 		if ( ! wp.media.isTouchDevice ) {
       
  8189 			/*
       
  8190 			Previously focused the first ':input' (the readonly URL text field).
       
  8191 			Since the first ':input' is now a button (delete/trash): when pressing
       
  8192 			spacebar on an attachment, Firefox fires deleteAttachment/trashAttachment
       
  8193 			as soon as focus is moved. Explicitly target the first text field for now.
       
  8194 			@todo change initial focus logic, also for accessibility.
       
  8195 			*/
       
  8196 			this.$( 'input[type="text"]' ).eq( 0 ).focus();
       
  8197 		}
       
  8198 	},
       
  8199 	/**
  8609 	/**
  8200 	 * @param {Object} event
  8610 	 * @param {Object} event
  8201 	 */
  8611 	 */
  8202 	deleteAttachment: function( event ) {
  8612 	deleteAttachment: function( event ) {
  8203 		event.preventDefault();
  8613 		event.preventDefault();
  8274 
  8684 
  8275 module.exports = Details;
  8685 module.exports = Details;
  8276 
  8686 
  8277 
  8687 
  8278 /***/ }),
  8688 /***/ }),
  8279 /* 88 */
  8689 /* 92 */
  8280 /***/ (function(module, exports) {
  8690 /***/ (function(module, exports) {
  8281 
  8691 
  8282 var View = wp.media.View,
  8692 var View = wp.media.View,
  8283 	AttachmentCompat;
  8693 	AttachmentCompat;
  8284 
  8694 
  8365 
  8775 
  8366 module.exports = AttachmentCompat;
  8776 module.exports = AttachmentCompat;
  8367 
  8777 
  8368 
  8778 
  8369 /***/ }),
  8779 /***/ }),
  8370 /* 89 */
  8780 /* 93 */
  8371 /***/ (function(module, exports) {
  8781 /***/ (function(module, exports) {
  8372 
  8782 
  8373 /**
  8783 /**
  8374  * wp.media.view.Iframe
  8784  * wp.media.view.Iframe
  8375  *
  8785  *
  8395 
  8805 
  8396 module.exports = Iframe;
  8806 module.exports = Iframe;
  8397 
  8807 
  8398 
  8808 
  8399 /***/ }),
  8809 /***/ }),
  8400 /* 90 */
  8810 /* 94 */
  8401 /***/ (function(module, exports) {
  8811 /***/ (function(module, exports) {
  8402 
  8812 
  8403 /**
  8813 /**
  8404  * wp.media.view.Embed
  8814  * wp.media.view.Embed
  8405  *
  8815  *
  8465 
  8875 
  8466 module.exports = Embed;
  8876 module.exports = Embed;
  8467 
  8877 
  8468 
  8878 
  8469 /***/ }),
  8879 /***/ }),
  8470 /* 91 */
  8880 /* 95 */
  8471 /***/ (function(module, exports) {
  8881 /***/ (function(module, exports) {
  8472 
  8882 
  8473 /**
  8883 /**
  8474  * wp.media.view.Label
  8884  * wp.media.view.Label
  8475  *
  8885  *
  8497 
  8907 
  8498 module.exports = Label;
  8908 module.exports = Label;
  8499 
  8909 
  8500 
  8910 
  8501 /***/ }),
  8911 /***/ }),
  8502 /* 92 */
  8912 /* 96 */
  8503 /***/ (function(module, exports) {
  8913 /***/ (function(module, exports) {
  8504 
  8914 
  8505 var View = wp.media.View,
  8915 var View = wp.media.View,
  8506 	$ = jQuery,
  8916 	$ = jQuery,
  8507 	EmbedUrl;
  8917 	EmbedUrl;
  8582 
  8992 
  8583 module.exports = EmbedUrl;
  8993 module.exports = EmbedUrl;
  8584 
  8994 
  8585 
  8995 
  8586 /***/ }),
  8996 /***/ }),
  8587 /* 93 */
  8997 /* 97 */
  8588 /***/ (function(module, exports) {
  8998 /***/ (function(module, exports) {
  8589 
  8999 
  8590 var $ = jQuery,
  9000 var $ = jQuery,
  8591 	EmbedLink;
  9001 	EmbedLink;
  8592 
  9002 
  8685 
  9095 
  8686 module.exports = EmbedLink;
  9096 module.exports = EmbedLink;
  8687 
  9097 
  8688 
  9098 
  8689 /***/ }),
  9099 /***/ }),
  8690 /* 94 */
  9100 /* 98 */
  8691 /***/ (function(module, exports) {
  9101 /***/ (function(module, exports) {
  8692 
  9102 
  8693 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
  9103 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
  8694 	EmbedImage;
  9104 	EmbedImage;
  8695 
  9105 
  8724 
  9134 
  8725 module.exports = EmbedImage;
  9135 module.exports = EmbedImage;
  8726 
  9136 
  8727 
  9137 
  8728 /***/ }),
  9138 /***/ }),
  8729 /* 95 */
  9139 /* 99 */
  8730 /***/ (function(module, exports) {
  9140 /***/ (function(module, exports) {
  8731 
  9141 
  8732 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
  9142 var AttachmentDisplay = wp.media.view.Settings.AttachmentDisplay,
  8733 	$ = jQuery,
  9143 	$ = jQuery,
  8734 	ImageDetails;
  9144 	ImageDetails;
  8898 
  9308 
  8899 module.exports = ImageDetails;
  9309 module.exports = ImageDetails;
  8900 
  9310 
  8901 
  9311 
  8902 /***/ }),
  9312 /***/ }),
  8903 /* 96 */
  9313 /* 100 */
  8904 /***/ (function(module, exports) {
  9314 /***/ (function(module, exports) {
  8905 
  9315 
  8906 var View = wp.media.View,
  9316 var View = wp.media.View,
  8907 	UploaderStatus = wp.media.view.UploaderStatus,
  9317 	UploaderStatus = wp.media.view.UploaderStatus,
  8908 	l10n = wp.media.view.l10n,
  9318 	l10n = wp.media.view.l10n,
  8999 
  9409 
  9000 module.exports = Cropper;
  9410 module.exports = Cropper;
  9001 
  9411 
  9002 
  9412 
  9003 /***/ }),
  9413 /***/ }),
  9004 /* 97 */
  9414 /* 101 */
  9005 /***/ (function(module, exports) {
  9415 /***/ (function(module, exports) {
  9006 
  9416 
  9007 var View = wp.media.view,
  9417 var View = wp.media.view,
  9008 	SiteIconCropper;
  9418 	SiteIconCropper;
  9009 
  9419 
  9048 
  9458 
  9049 module.exports = SiteIconCropper;
  9459 module.exports = SiteIconCropper;
  9050 
  9460 
  9051 
  9461 
  9052 /***/ }),
  9462 /***/ }),
  9053 /* 98 */
  9463 /* 102 */
  9054 /***/ (function(module, exports) {
  9464 /***/ (function(module, exports) {
  9055 
  9465 
  9056 var View = wp.media.View,
  9466 var View = wp.media.View,
  9057 	$ = jQuery,
  9467 	$ = jQuery,
  9058 	SiteIconPreview;
  9468 	SiteIconPreview;
  9110 
  9520 
  9111 module.exports = SiteIconPreview;
  9521 module.exports = SiteIconPreview;
  9112 
  9522 
  9113 
  9523 
  9114 /***/ }),
  9524 /***/ }),
  9115 /* 99 */
  9525 /* 103 */
  9116 /***/ (function(module, exports) {
  9526 /***/ (function(module, exports) {
  9117 
  9527 
  9118 var View = wp.media.View,
  9528 var View = wp.media.View,
  9119 	EditImage;
  9529 	EditImage;
  9120 
  9530 
  9172 
  9582 
  9173 module.exports = EditImage;
  9583 module.exports = EditImage;
  9174 
  9584 
  9175 
  9585 
  9176 /***/ }),
  9586 /***/ }),
  9177 /* 100 */
  9587 /* 104 */
  9178 /***/ (function(module, exports) {
  9588 /***/ (function(module, exports) {
  9179 
  9589 
  9180 /**
  9590 /**
  9181  * wp.media.view.Spinner
  9591  * wp.media.view.Spinner
       
  9592  *
       
  9593  * Represents a spinner in the Media Library.
       
  9594  *
       
  9595  * @since 3.9.0
  9182  *
  9596  *
  9183  * @memberOf wp.media.view
  9597  * @memberOf wp.media.view
  9184  *
  9598  *
  9185  * @class
  9599  * @class
  9186  * @augments wp.media.View
  9600  * @augments wp.media.View
  9191 	tagName:   'span',
  9605 	tagName:   'span',
  9192 	className: 'spinner',
  9606 	className: 'spinner',
  9193 	spinnerTimeout: false,
  9607 	spinnerTimeout: false,
  9194 	delay: 400,
  9608 	delay: 400,
  9195 
  9609 
       
  9610 	/**
       
  9611 	 * Shows the spinner. Delays the visibility by the configured amount.
       
  9612 	 *
       
  9613 	 * @since 3.9.0
       
  9614 	 *
       
  9615 	 * @return {wp.media.view.Spinner} The spinner.
       
  9616 	 */
  9196 	show: function() {
  9617 	show: function() {
  9197 		if ( ! this.spinnerTimeout ) {
  9618 		if ( ! this.spinnerTimeout ) {
  9198 			this.spinnerTimeout = _.delay(function( $el ) {
  9619 			this.spinnerTimeout = _.delay(function( $el ) {
  9199 				$el.addClass( 'is-active' );
  9620 				$el.addClass( 'is-active' );
  9200 			}, this.delay, this.$el );
  9621 			}, this.delay, this.$el );
  9201 		}
  9622 		}
  9202 
  9623 
  9203 		return this;
  9624 		return this;
  9204 	},
  9625 	},
  9205 
  9626 
       
  9627 	/**
       
  9628 	 * Hides the spinner.
       
  9629 	 *
       
  9630 	 * @since 3.9.0
       
  9631 	 *
       
  9632 	 * @return {wp.media.view.Spinner} The spinner.
       
  9633 	 */
  9206 	hide: function() {
  9634 	hide: function() {
  9207 		this.$el.removeClass( 'is-active' );
  9635 		this.$el.removeClass( 'is-active' );
  9208 		this.spinnerTimeout = clearTimeout( this.spinnerTimeout );
  9636 		this.spinnerTimeout = clearTimeout( this.spinnerTimeout );
  9209 
  9637 
  9210 		return this;
  9638 		return this;
  9212 });
  9640 });
  9213 
  9641 
  9214 module.exports = Spinner;
  9642 module.exports = Spinner;
  9215 
  9643 
  9216 
  9644 
       
  9645 /***/ }),
       
  9646 /* 105 */
       
  9647 /***/ (function(module, exports) {
       
  9648 
       
  9649 /**
       
  9650  * wp.media.view.Heading
       
  9651  *
       
  9652  * A reusable heading component for the media library
       
  9653  *
       
  9654  * Used to add accessibility friendly headers in the media library/modal.
       
  9655  *
       
  9656  * @class
       
  9657  * @augments wp.media.View
       
  9658  * @augments wp.Backbone.View
       
  9659  * @augments Backbone.View
       
  9660  */
       
  9661 var Heading = wp.media.View.extend( {
       
  9662 	tagName: function() {
       
  9663 		return this.options.level || 'h1';
       
  9664 	},
       
  9665 	className: 'media-views-heading',
       
  9666 
       
  9667 	initialize: function() {
       
  9668 
       
  9669 		if ( this.options.className ) {
       
  9670 			this.$el.addClass( this.options.className );
       
  9671 		}
       
  9672 
       
  9673 		this.text = this.options.text;
       
  9674 	},
       
  9675 
       
  9676 	render: function() {
       
  9677 		this.$el.html( this.text );
       
  9678 		return this;
       
  9679 	}
       
  9680 } );
       
  9681 
       
  9682 module.exports = Heading;
       
  9683 
       
  9684 
  9217 /***/ })
  9685 /***/ })
  9218 /******/ ]));
  9686 /******/ ]));