Changeset 27537
- Timestamp:
- 03/14/2014 01:16:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-editor.js
r27530 r27537 297 297 } 298 298 return attrs[ key ]; 299 }, 300 301 pauseAllPlayers: function () { 302 var p; 303 if ( window.mejs && window.mejs.players ) { 304 for ( p in window.mejs.players ) { 305 window.mejs.players[p].pause(); 306 } 307 } 299 308 } 300 309 }; … … 303 312 var collections = {}; 304 313 305 return _.extend( attributes, wp.media.mixin, { 314 return _.extend( attributes, { 315 coerce : wp.media.mixin.coerce, 306 316 /** 307 317 * Retrieve attachments based on the properties of the passed shortcode … … 559 569 * @namespace 560 570 */ 561 wp.media.audio = _.extend({ 571 wp.media.audio = { 572 coerce : wp.media.mixin.coerce, 573 562 574 defaults : { 563 575 id : wp.media.view.settings.post.id, … … 598 610 }); 599 611 } 600 } , wp.media.mixin);612 }; 601 613 602 614 /** 603 615 * @namespace 604 616 */ 605 wp.media.video = _.extend({ 617 wp.media.video = { 618 coerce : wp.media.mixin.coerce, 619 606 620 defaults : { 607 621 id : wp.media.view.settings.post.id, … … 650 664 }); 651 665 } 652 } , wp.media.mixin);666 }; 653 667 654 668 /** … … 1112 1126 */ 1113 1127 init: function() { 1114 $(document.body).on( 'click', '.insert-media', function( event ) { 1115 var elem = $( event.currentTarget ), 1116 editor = elem.data('editor'), 1117 options = { 1118 frame: 'post', 1119 state: 'insert', 1120 title: wp.media.view.l10n.addMedia, 1121 multiple: true 1122 }; 1123 1124 event.preventDefault(); 1125 1126 // Remove focus from the `.insert-media` button. 1127 // Prevents Opera from showing the outline of the button 1128 // above the modal. 1129 // 1130 // See: http://core.trac.wordpress.org/ticket/22445 1131 elem.blur(); 1132 1133 if ( elem.hasClass( 'gallery' ) ) { 1134 options.state = 'gallery'; 1135 options.title = wp.media.view.l10n.createGalleryTitle; 1136 } else if ( elem.hasClass( 'playlist' ) ) { 1137 options.state = 'playlist'; 1138 options.title = wp.media.view.l10n.createPlaylistTitle; 1139 } else if ( elem.hasClass( 'video-playlist' ) ) { 1140 options.state = 'video-playlist'; 1141 options.title = wp.media.view.l10n.createVideoPlaylistTitle; 1142 } 1143 1144 wp.media.editor.open( editor, options ); 1145 }); 1128 $(document.body) 1129 .on( 'click', '.insert-media', function( event ) { 1130 var elem = $( event.currentTarget ), 1131 editor = elem.data('editor'), 1132 options = { 1133 frame: 'post', 1134 state: 'insert', 1135 title: wp.media.view.l10n.addMedia, 1136 multiple: true 1137 }; 1138 1139 event.preventDefault(); 1140 1141 // Remove focus from the `.insert-media` button. 1142 // Prevents Opera from showing the outline of the button 1143 // above the modal. 1144 // 1145 // See: http://core.trac.wordpress.org/ticket/22445 1146 elem.blur(); 1147 1148 if ( elem.hasClass( 'gallery' ) ) { 1149 options.state = 'gallery'; 1150 options.title = wp.media.view.l10n.createGalleryTitle; 1151 } else if ( elem.hasClass( 'playlist' ) ) { 1152 options.state = 'playlist'; 1153 options.title = wp.media.view.l10n.createPlaylistTitle; 1154 } else if ( elem.hasClass( 'video-playlist' ) ) { 1155 options.state = 'video-playlist'; 1156 options.title = wp.media.view.l10n.createVideoPlaylistTitle; 1157 } 1158 1159 wp.media.editor.open( editor, options ); 1160 }) 1161 .on( 'click', '.wp-switch-editor', wp.media.mixin.pauseAllPlayers ); 1146 1162 1147 1163 // Initialize and render the Editor drag-and-drop uploader.
Note: See TracChangeset
for help on using the changeset viewer.