WordPress.org

Make WordPress Core

Changeset 40827


Ignore:
Timestamp:
05/24/17 05:31:00 (5 months ago)
Author:
westonruter
Message:

Widgets: Prevent multiple items from being selectable when first populating a media widget.

Amends [40640].
Props obenland, timmydcrawford.
See #32417.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/widgets/media-widgets.js

    r40821 r40827  
    641641         */ 
    642642        selectMedia: function selectMedia() { 
    643             var control = this, selection, mediaFrame, defaultSync, mediaFrameProps; 
     643            var control = this, selection, mediaFrame, defaultSync, mediaFrameProps, selectionModels = []; 
    644644 
    645645            if ( control.isSelected() && 0 !== control.model.get( 'attachment_id' ) ) { 
    646                 selection = new wp.media.model.Selection([ control.selectedAttachment ]); 
    647             } else { 
    648                 selection = null; 
    649             } 
     646                selectionModels.push( control.selectedAttachment ); 
     647            } 
     648 
     649            selection = new wp.media.model.Selection( selectionModels, { multiple: false } ); 
    650650 
    651651            mediaFrameProps = control.mapModelToMediaFrameProps( control.model.toJSON() ); 
Note: See TracChangeset for help on using the changeset viewer.