Changeset 42798
- Timestamp:
- 03/08/2018 04:24:16 PM (7 years ago)
- Location:
- trunk/src/wp-includes/js/media/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media/controllers/gallery-add.js
r41351 r42798 9 9 * A state for selecting more images to add to a gallery. 10 10 * 11 * @ memberOf wp.media.controller11 * @since 3.5.0 12 12 * 13 13 * @class … … 16 16 * @augments Backbone.Model 17 17 * 18 * @param {object} [attributes] The attributes hash passed to the state. 18 * @memberof wp.media.controller 19 * 20 * @param {Object} [attributes] The attributes hash passed to the state. 19 21 * @param {string} [attributes.id=gallery-library] Unique identifier. 20 22 * @param {string} [attributes.title=Add to Gallery] Title for the state. Displays in the frame's title region. … … 33 35 * @param {boolean} [attributes.autoSelect=true] Whether an uploaded attachment should be automatically added to the selection. 34 36 * @param {boolean} [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user. 35 * @param { int}[attributes.priority=100] The priority for the state link in the media menu.37 * @param {number} [attributes.priority=100] The priority for the state link in the media menu. 36 38 * @param {boolean} [attributes.syncSelection=false] Whether the Attachments selection should be persisted from the last state. 37 39 * Defaults to false because for this state, because the library of the Edit Gallery state is the selection. … … 50 52 51 53 /** 54 * Initializes the library. Creates a library of images if a library isn't supplied. 55 * 52 56 * @since 3.5.0 57 * 58 * @returns {void} 53 59 */ 54 60 initialize: function() { 55 // If a library wasn't supplied, create a library of images.56 61 if ( ! this.get('library') ) { 57 62 this.set( 'library', wp.media.query({ type: 'image' }) ); … … 62 67 63 68 /** 69 * Activates the library. 70 * 71 * Removes all event listeners if in edit mode. Creates a validator to check an attachment. 72 * Resets library and re-enables event listeners. Activates edit mode. Calls the parent's activate method. 73 * 64 74 * @since 3.5.0 75 * 76 * @returns {void} 65 77 */ 66 78 activate: function() { … … 72 84 } 73 85 74 // Accepts attachments that exist in the original library and 75 // that do not exist in gallery's library. 86 /* 87 * Accept attachments that exist in the original library but 88 * that do not exist in gallery's library yet. 89 */ 76 90 library.validator = function( attachment ) { 77 91 return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && Selection.prototype.validator.apply( this, arguments ); 78 92 }; 79 93 80 // Reset the library to ensure that all attachments are re-added 81 // to the collection. Do so silently, as calling `observe` will 82 // trigger the `reset` event. 94 /* 95 * Reset the library to ensure that all attachments are re-added 96 * to the collection. Do so silently, as calling `observe` will 97 * trigger the `reset` event. 98 */ 83 99 library.reset( library.mirroring.models, { silent: true }); 84 100 library.observe( edit ); -
trunk/src/wp-includes/js/media/controllers/gallery-edit.js
r41351 r42798 8 8 * A state for editing a gallery's images and settings. 9 9 * 10 * @ memberOf wp.media.controller10 * @since 3.5.0 11 11 * 12 12 * @class … … 14 14 * @augments wp.media.controller.State 15 15 * @augments Backbone.Model 16 * 17 * @memberOf wp.media.controller 16 18 * 17 19 * @param {object} [attributes] The attributes hash passed to the state. … … 29 31 * @param {boolean} [attributes.displaySettings=true] Whether to show the attachment display settings interface. 30 32 * @param {boolean} [attributes.dragInfo=true] Whether to show instructional text about the attachments being sortable. 31 * @param { int}[attributes.idealColumnWidth=170] The ideal column width in pixels for attachments.33 * @param {number} [attributes.idealColumnWidth=170] The ideal column width in pixels for attachments. 32 34 * @param {boolean} [attributes.editing=false] Whether the gallery is being created, or editing an existing instance. 33 * @param { int}[attributes.priority=60] The priority for the state link in the media menu.35 * @param {number} [attributes.priority=60] The priority for the state link in the media menu. 34 36 * @param {boolean} [attributes.syncSelection=false] Whether the Attachments selection should be persisted from the last state. 35 37 * Defaults to false for this state, because the library passed in *is* the selection.
Note: See TracChangeset
for help on using the changeset viewer.