Changeset 27481
- Timestamp:
- 03/09/2014 10:31:36 AM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r27422 r27481 1984 1984 'css' => 'text/css', 1985 1985 'htm|html' => 'text/html', 1986 'vtt' => 'text/vtt', 1986 1987 // Audio formats 1987 1988 'mp3|m4a|m4b' => 'audio/mpeg', -
trunk/src/wp-includes/js/media-editor.js
r27445 r27481 610 610 loop : false, 611 611 autoplay : false, 612 preload : 'metadata' 612 preload : 'metadata', 613 content : '' 613 614 }, 614 615 615 616 edit : function (data) { 616 var frame, shortcode = wp.shortcode.next( 'video', data ).shortcode; 617 var frame, 618 defaults = this.defaults, 619 shortcode = wp.shortcode.next( 'video', data ).shortcode, 620 attrs; 621 622 attrs = shortcode.attrs.named; 623 attrs.content = shortcode.content; 624 617 625 frame = wp.media({ 618 626 frame: 'video', 619 627 state: 'video-details', 620 metadata: _.defaults( 621 shortcode.attrs.named, 622 wp.media.video.defaults 623 ) 628 metadata: _.defaults( attrs, defaults ) 624 629 }); 625 630 … … 628 633 629 634 shortcode : function (shortcode) { 630 var self = this; 631 _.each( wp.media.video.defaults, function( value, key ) { 635 var self = this, content = shortcode.content; 636 delete shortcode.content; 637 638 _.each( this.defaults, function( value, key ) { 632 639 shortcode[ key ] = self.coerce( shortcode, key ); 633 640 … … 639 646 return wp.shortcode.string({ 640 647 tag: 'video', 641 attrs: shortcode 648 attrs: shortcode, 649 content: content 642 650 }); 643 651 } -
trunk/src/wp-includes/js/media-views.js
r27480 r27481 1194 1194 defaults: _.defaults({ 1195 1195 filterable: 'uploaded', 1196 multiple: false,1197 1196 priority: 80, 1198 1197 syncSelection: false, 1199 displaySettings: true1198 displaySettings: false 1200 1199 }, media.controller.Library.prototype.defaults ), 1201 1200 1202 1201 initialize: function( options ) { 1203 var library, comparator;1204 1205 1202 this.media = options.media; 1206 1203 this.set( 'library', media.query({ type: options.type }) ); 1207 1204 1208 1205 media.controller.Library.prototype.initialize.apply( this, arguments ); 1209 1210 library = this.get('library');1211 comparator = library.comparator;1212 1213 // Overload the library's comparator to push items that are not in1214 // the mirrored query to the front of the aggregate collection.1215 library.comparator = function( a, b ) {1216 var aInQuery = !! this.mirroring.get( a.cid ),1217 bInQuery = !! this.mirroring.get( b.cid );1218 1219 if ( ! aInQuery && bInQuery ) {1220 return -1;1221 } else if ( aInQuery && ! bInQuery ) {1222 return 1;1223 } else {1224 return comparator.apply( this, arguments );1225 }1226 };1227 1228 // Add all items in the selection to the library, so any featured1229 // images that are not initially loaded still appear.1230 library.observe( this.get('selection') );1231 1206 } 1232 1207 }); … … 2953 2928 this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this ); 2954 2929 this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this ); 2930 this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this ); 2955 2931 }, 2956 2932 … … 2988 2964 media: this.media, 2989 2965 menu: 'video-details' 2966 } ), 2967 2968 new media.controller.MediaLibrary( { 2969 type: 'text', 2970 id: 'add-track', 2971 title: l10n.videoAddTrackTitle, 2972 toolbar: 'add-track', 2973 media: this.media, 2974 menu: 'video-details' 2990 2975 } ) 2991 2976 ]); … … 3010 2995 3011 2996 state.trigger( 'set-poster-image', controller.media.toJSON() ); 2997 2998 // Restore and reset the default state. 2999 controller.setState( controller.options.state ); 3000 controller.reset(); 3001 } 3002 } 3003 } 3004 }) ); 3005 }, 3006 3007 renderAddTrackToolbar: function() { 3008 this.toolbar.set( new media.view.Toolbar({ 3009 controller: this, 3010 items: { 3011 replace: { 3012 style: 'primary', 3013 text: l10n.videoAddTrackTitle, 3014 priority: 80, 3015 3016 click: function() { 3017 var controller = this.controller, 3018 state = controller.state(), 3019 selection = state.get( 'selection' ), 3020 attachment = selection.single(), 3021 content = controller.media.get( 'content' ); 3022 3023 if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) { 3024 content += [ 3025 '<track srclang="en" label="English"kind="subtitles" src="', 3026 attachment.get( 'url' ), 3027 '" />' 3028 ].join(''); 3029 3030 controller.media.set( 'content', content ); 3031 } 3032 3033 state.trigger( 'add-track', controller.media.toJSON() ); 3012 3034 3013 3035 // Restore and reset the default state. … … 6367 6389 this.on( 'media:setting:remove', this.setPlayer ); 6368 6390 this.events = _.extend( this.events, { 6369 'click .remove-setting' : 'removeSetting' 6391 'click .remove-setting' : 'removeSetting', 6392 'change .content-track' : 'setTracks', 6393 'click .remove-track' : 'setTracks' 6370 6394 } ); 6371 6395 … … 6374 6398 6375 6399 prepare: function() { 6376 var attachment = false;6377 6378 if ( this.model.attachment ) {6379 attachment = this.model.attachment.toJSON();6380 }6381 6400 return _.defaults({ 6382 model: this.model.toJSON(), 6383 attachment: attachment 6401 model: this.model.toJSON() 6384 6402 }, this.options ); 6385 6403 }, … … 6405 6423 6406 6424 removeSetting : function (e) { 6407 var setting = $( e.currentTarget ).parent(); 6408 6409 this.model.unset( setting.find( 'input' ).data( 'setting' ) ); 6410 6411 setting.remove(); 6412 6425 var wrap = $( e.currentTarget ).parent(), setting; 6426 6427 setting = wrap.find( 'input' ).data( 'setting' ); 6428 6429 if ( setting ) { 6430 this.model.unset( setting ); 6431 this.trigger( 'media:setting:remove', this ); 6432 } 6433 6434 wrap.remove(); 6435 }, 6436 6437 setTracks : function () { 6438 var tracks = ''; 6439 6440 _.each( this.$('.content-track'), function (track) { 6441 tracks += $( track ).val(); 6442 } ); 6443 6444 this.model.set( 'content', tracks ); 6413 6445 this.trigger( 'media:setting:remove', this ); 6414 6446 }, -
trunk/src/wp-includes/js/mediaelement/wp-mediaelement.css
r27480 r27481 20 20 } 21 21 22 .media-embed-details .embed-media-settings .setting span { 23 max-width: 400px; 24 width: auto; 25 } 26 22 27 .media-embed-details .embed-media-settings { 23 28 padding-top: 0; … … 29 34 } 30 35 36 .media-embed-details .setting p, 31 37 .media-embed-details .setting a { 32 38 color: #a00; 39 font-size: 10px; 40 text-transform: uppercase; 33 41 } 34 42 -
trunk/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
r27478 r27481 98 98 frame.detach(); 99 99 } ); 100 frame.state( 'video-details' ).on( 'update replace add-source select-poster-image', function ( selection ) { 101 var shortcode = wp.media.video.shortcode( selection ); 102 editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); 103 frame.detach(); 104 } ); 100 frame.state( 'video-details' ).on( 101 'update replace add-source select-poster-image add-track', 102 function ( selection ) { 103 var shortcode = wp.media.video.shortcode( selection ); 104 editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); 105 frame.detach(); 106 } 107 ); 105 108 frame.open(); 106 109 } else if ( editor.dom.hasClass( node, 'wp-audio' ) ) { -
trunk/src/wp-includes/media-template.php
r27480 r27481 691 691 <span>SRC</span> 692 692 <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> 693 <a class="remove-setting">{{{ wp.media.view.l10n. audioRemoveSource }}}</a>693 <a class="remove-setting">{{{ wp.media.view.l10n.remove }}}</a> 694 694 </label> 695 695 <# } #> … … 701 701 <span><?php echo strtoupper( $type ) ?></span> 702 702 <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> 703 <a class="remove-setting">{{{ wp.media.view.l10n. audioRemoveSource }}}</a>703 <a class="remove-setting">{{{ wp.media.view.l10n.remove }}}</a> 704 704 </label> 705 705 <# } #> … … 780 780 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" /> 781 781 <# } #> 782 <?php endforeach; 783 ?></video> 782 <?php endforeach; ?> 783 {{{ data.model.content }}} 784 </video> 784 785 <# if ( ! _.isEmpty( data.model.src ) ) { #> 785 786 <label class="setting"> 786 787 <span>SRC</span> 787 788 <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> 788 <a class="remove-setting">{{{ wp.media.view.l10n. videoRemoveSource }}}</a>789 <a class="remove-setting">{{{ wp.media.view.l10n.remove }}}</a> 789 790 </label> 790 791 <# } #> … … 794 795 <span><?php echo strtoupper( $type ) ?></span> 795 796 <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> 796 <a class="remove-setting">{{{ wp.media.view.l10n. videoRemoveSource }}}</a>797 <a class="remove-setting">{{{ wp.media.view.l10n.remove }}}</a> 797 798 </label> 798 799 <# } #> … … 803 804 <span><?php _e( 'Poster Image' ); ?></span> 804 805 <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" /> 805 <a class="remove-setting">{{{ wp.media.view.l10n. videoRemovePoster}}}</a>806 <a class="remove-setting">{{{ wp.media.view.l10n.remove }}}</a> 806 807 </label> 807 808 <# } #> … … 825 826 </label> 826 827 <div class="clear"></div> 828 829 <label class="setting" data-setting="content"> 830 <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters or metadata)' ); ?></span> 831 <# 832 var content = ''; 833 if ( ! _.isEmpty( data.model.content ) ) { 834 var tracks = jQuery( data.model.content ).filter( 'track' ); 835 _.each( tracks.toArray(), function (track) { 836 content += track.outerHTML; #> 837 <p> 838 <input class="content-track" type="text" value="{{ track.outerHTML }}" /> 839 <a class="remove-setting remove-track">{{{ wp.media.view.l10n.remove }}}</a> 840 </p> 841 <# } ); #> 842 <# } else { #> 843 <em>There are no associated subtitles.</em> 844 <# } #> 845 <textarea class="hidden content-setting">{{ content }}</textarea> 846 </label> 827 847 </div> 828 848 </div> -
trunk/src/wp-includes/media.php
r27478 r27481 2396 2396 'update' => __( 'Update' ), 2397 2397 'replace' => __( 'Replace' ), 2398 'back' => __( 'Back' ), 2398 'remove' => __( 'Remove' ), 2399 'back' => __( 'Back' ), 2399 2400 /* translators: This is a would-be plural string used in the media manager. 2400 2401 If there is not a word you can use in your language to avoid issues with the … … 2451 2452 'audioDetailsText' => __( '"Replace Audio" will remove all associated source files when you update. ' . 2452 2453 '"Add Audio Source" allows you to specify alternate sources for maximum native HTML5 audio playback.' ), 2453 'audioRemoveSource' => __( 'Remove Audio Source' ),2454 2454 2455 2455 // Edit Video … … 2460 2460 'videoDetailsText' => __( '"Replace Video" will remove all associated source files when you update. ' . 2461 2461 '"Add Video Source" allows you to specify alternate sources for maximum native HTML5 video playback.' ), 2462 'videoRemoveSource' => __( 'Remove Video Source' ),2463 2462 'videoSelectPosterImageTitle' => _( 'Select Poster Image' ), 2464 'video RemovePoster' => __( 'Remove Poster Image' ),2463 'videoAddTrackTitle' => __( 'Add Subtitles' ), 2465 2464 2466 2465 // Playlist
Note: See TracChangeset
for help on using the changeset viewer.