Widgets: Prevent multiple items from being selectable when first populating a media widget.
Amends [40640]. Props obenland, timmydcrawford. See #32417. git-svn-id: https://develop.svn.wordpress.org/trunk@40827 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f8dabb5b35
commit
6d02212d57
|
@ -640,14 +640,14 @@ wp.mediaWidgets = ( function( $ ) {
|
|||
* @returns {void}
|
||||
*/
|
||||
selectMedia: function selectMedia() {
|
||||
var control = this, selection, mediaFrame, defaultSync, mediaFrameProps;
|
||||
var control = this, selection, mediaFrame, defaultSync, mediaFrameProps, selectionModels = [];
|
||||
|
||||
if ( control.isSelected() && 0 !== control.model.get( 'attachment_id' ) ) {
|
||||
selection = new wp.media.model.Selection([ control.selectedAttachment ]);
|
||||
} else {
|
||||
selection = null;
|
||||
selectionModels.push( control.selectedAttachment );
|
||||
}
|
||||
|
||||
selection = new wp.media.model.Selection( selectionModels, { multiple: false } );
|
||||
|
||||
mediaFrameProps = control.mapModelToMediaFrameProps( control.model.toJSON() );
|
||||
if ( mediaFrameProps.size ) {
|
||||
control.displaySettings.set( 'size', mediaFrameProps.size );
|
||||
|
|
Loading…
Reference in New Issue