Changeset 27530
- Timestamp:
- 03/13/2014 11:38:14 PM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-editor.php
r27528 r27530 344 344 $version = 'ver=' . $GLOBALS['wp_version']; 345 345 $dashicons = includes_url( "css/dashicons$suffix.css?$version" ); 346 $mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );347 $wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );348 346 349 347 // WordPress default stylesheet and dashicons 350 $mce_css = array( 351 $dashicons, 352 $mediaelement, 353 $wpmediaelement, 354 self::$baseurl . '/skins/wordpress/wp-content.css' 355 ); 348 $mce_css = array( $dashicons, self::$baseurl . '/skins/wordpress/wp-content.css' ); 356 349 357 350 // load editor_style.css if the current theme supports it -
trunk/src/wp-includes/js/mce-view.js
r27528 r27530 1 /* global tinymce , _wpmejsSettings, MediaElementPlayer*/1 /* global tinymce */ 2 2 3 3 // Ensure the global `wp` object exists. … … 32 32 // Search all tinymce editor instances and update the placeholders 33 33 _.each( tinymce.editors, function( editor ) { 34 var doc , self = this;34 var doc; 35 35 if ( editor.plugins.wpview ) { 36 36 doc = editor.getDoc(); 37 $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).each(function (i, elem) { 38 var node = $( elem ); 39 node.html( html ); 40 $( self ).trigger( 'ready', elem ); 41 }); 37 $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).html( html ); 42 38 } 43 39 }, this ); … … 183 179 /** 184 180 * Refresh views after an update is made 185 * 181 * 186 182 * @param view {object} being refreshed 187 183 * @param text {string} textual representation of the view … … 209 205 }, 210 206 211 /** 207 /** 212 208 * render( scope ) 213 * 209 * 214 210 * Renders any view instances inside a DOM node `scope`. 215 211 * … … 307 303 }; 308 304 wp.mce.views.register( 'gallery', wp.mce.gallery ); 309 310 wp.mce.media = {311 toView: function( content ) {312 var match = wp.shortcode.next( this.shortcode, content );313 314 if ( ! match ) {315 return;316 }317 318 return {319 index: match.index,320 content: match.content,321 options: {322 shortcode: match.shortcode323 }324 };325 },326 327 edit: function( node ) {328 var p,329 media = wp.media[ this.shortcode ],330 self = this,331 frame, data;332 333 for (p in window.mejs.players) {334 window.mejs.players[p].pause();335 }336 337 data = window.decodeURIComponent( $( node ).data('wpview-text') );338 frame = media.edit( data );339 frame.on( 'close', function () {340 frame.detach();341 } );342 frame.state( self.shortcode + '-details' ).on( 'update', function( selection ) {343 var shortcode = wp.media[ self.shortcode ].update( selection ).string();344 $( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );345 wp.mce.views.refreshView( self, shortcode );346 frame.detach();347 } );348 frame.open();349 }350 };351 352 wp.mce.media.ViewMixin = wp.mce.View.extend({353 initialize: function( options ) {354 this.shortcode = options.shortcode;355 _.bindAll( this, 'setPlayer' );356 $(this).on( 'ready', this.setPlayer );357 },358 359 setPlayer: function (e, node) {360 // if the ready event fires on an empty node361 if ( ! node ) {362 return;363 }364 365 var id,366 media,367 settings = {},368 className = '.wp-' + this.shortcode.tag + '-shortcode';369 370 media = $( node ).find( className );371 372 if ( media.hasClass( 'rendered' ) ) {373 id = media.closest( className ).attr( 'id' );374 window.mejs.players[ id ].remove();375 } else {376 media.addClass( 'rendered' );377 }378 379 media.prop( 'preload', 'none' );380 media = media.get(0);381 382 if ( ! _.isUndefined( window._wpmejsSettings ) ) {383 settings.pluginPath = _wpmejsSettings.pluginPath;384 }385 386 media = wp.media.view.MediaDetails.prepareSrc( media );387 new MediaElementPlayer( media, settings );388 },389 390 getHtml: function() {391 var attrs = this.shortcode.attrs.named;392 return this.template({ model: attrs });393 }394 });395 396 wp.mce.video = _.extend( {}, wp.mce.media, {397 shortcode: 'video',398 View: wp.mce.media.ViewMixin.extend({399 className: 'editor-video',400 template: media.template('editor-video')401 })402 } );403 404 wp.mce.views.register( 'video', wp.mce.video );405 406 wp.mce.audio = _.extend( {}, wp.mce.media, {407 shortcode: 'audio',408 View: wp.mce.media.ViewMixin.extend({409 className: 'editor-audio',410 template: media.template('editor-audio')411 })412 } );413 414 wp.mce.views.register( 'audio', wp.mce.audio );415 305 }(jQuery)); -
trunk/src/wp-includes/js/media-editor.js
r27528 r27530 582 582 }, 583 583 584 update : function (model) {585 var self = this , content;586 587 _.each( this.defaults, function( value, key ) {588 model[ key ] = self.coerce( model, key );589 590 if ( value === model[ key ] ) {591 delete model[ key ];584 shortcode : function (shortcode) { 585 var self = this; 586 587 _.each( wp.media.audio.defaults, function( value, key ) { 588 shortcode[ key ] = self.coerce( shortcode, key ); 589 590 if ( value === shortcode[ key ] ) { 591 delete shortcode[ key ]; 592 592 } 593 593 }); 594 594 595 content = model.content; 596 delete model.content; 597 598 return new wp.shortcode({ 599 tag: 'audio', 600 attrs: model, 601 content: content 595 return wp.shortcode.string({ 596 tag: 'audio', 597 attrs: shortcode 602 598 }); 603 599 } … … 636 632 }, 637 633 638 update : function (model) { 639 var self = this, content = ''; 634 shortcode : function (shortcode) { 635 var self = this, content = shortcode.content; 636 delete shortcode.content; 640 637 641 638 _.each( this.defaults, function( value, key ) { 642 model[ key ] = self.coerce( model, key );643 644 if ( value === model[ key ] ) {645 delete model[ key ];639 shortcode[ key ] = self.coerce( shortcode, key ); 640 641 if ( value === shortcode[ key ] ) { 642 delete shortcode[ key ]; 646 643 } 647 644 }); 648 645 649 content = model.content; 650 delete model.content; 651 652 return new wp.shortcode({ 653 tag: 'video', 654 attrs: model, 646 return wp.shortcode.string({ 647 tag: 'video', 648 attrs: shortcode, 655 649 content: content 656 650 }); … … 1118 1112 */ 1119 1113 init: function() { 1120 $(document.body) 1121 .on( 'click', '.insert-media', function( event ) { 1122 var elem = $( event.currentTarget ), 1123 editor = elem.data('editor'), 1124 options = { 1125 frame: 'post', 1126 state: 'insert', 1127 title: wp.media.view.l10n.addMedia, 1128 multiple: true 1129 }; 1130 1131 event.preventDefault(); 1132 1133 // Remove focus from the `.insert-media` button. 1134 // Prevents Opera from showing the outline of the button 1135 // above the modal. 1136 // 1137 // See: http://core.trac.wordpress.org/ticket/22445 1138 elem.blur(); 1139 1140 if ( elem.hasClass( 'gallery' ) ) { 1141 options.state = 'gallery'; 1142 options.title = wp.media.view.l10n.createGalleryTitle; 1143 } else if ( elem.hasClass( 'playlist' ) ) { 1144 options.state = 'playlist'; 1145 options.title = wp.media.view.l10n.createPlaylistTitle; 1146 } else if ( elem.hasClass( 'video-playlist' ) ) { 1147 options.state = 'video-playlist'; 1148 options.title = wp.media.view.l10n.createVideoPlaylistTitle; 1149 } 1150 1151 wp.media.editor.open( editor, options ); 1152 }) 1153 .on( 'click', '.wp-switch-editor', function () { 1154 var p; 1155 if ( window.mejs && window.mejs.players ) { 1156 for ( p in window.mejs.players ) { 1157 window.mejs.players[p].pause(); 1158 } 1159 } 1160 } ); 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 }); 1161 1146 1162 1147 // Initialize and render the Editor drag-and-drop uploader. -
trunk/src/wp-includes/js/media-models.js
r27528 r27530 468 468 this.extension = attachment.get('filename' ).split('.').pop(); 469 469 470 this.unset( 'src' );471 470 if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) { 472 471 this.set( this.extension, this.attachment.get( 'url' ) ); -
trunk/src/wp-includes/js/media-views.js
r27528 r27530 6543 6543 }, 6544 6544 6545 /** 6546 * When multiple players in the DOM contain the same src, things get weird. 6547 * 6548 * @param {HTMLElement} media 6549 * @returns {HTMLElement} 6550 */ 6551 prepareSrc : function (media) { 6552 var i = wp.media.view.MediaDetails.instances++; 6553 _.each( $(media).find('source'), function (source) { 6554 source.src = [ 6555 source.src, 6556 source.src.indexOf('?') > -1 ? '&' : '?', 6557 '_=', 6558 i 6559 ].join(''); 6560 }); 6561 6562 return media; 6563 }, 6564 6545 6565 removeSetting : function (e) { 6546 6566 var wrap = $( e.currentTarget ).parent(), setting; … … 6614 6634 6615 6635 unsetPlayer : function() { 6616 var p;6617 6636 if ( this.player ) { 6618 for ( p in window.mejs.players) {6619 window.mejs.players[p].pause();6637 if ( _.isUndefined( this.mejs.pluginType ) ) { 6638 this.mejs.pause(); 6620 6639 } 6621 6640 this.removePlayer(); … … 6657 6676 } 6658 6677 }, { 6659 instances : 0, 6660 6661 /** 6662 * When multiple players in the DOM contain the same src, things get weird. 6663 * 6664 * @param {HTMLElement} media 6665 * @returns {HTMLElement} 6666 */ 6667 prepareSrc : function (media) { 6668 var i = wp.media.view.MediaDetails.instances++; 6669 if ( 0 === i ) { 6670 i = (new Date()).getTime(); 6671 } 6672 _.each( $(media).find('source'), function (source) { 6673 source.src = [ 6674 source.src, 6675 source.src.indexOf('?') > -1 ? '&' : '?', 6676 '_=', 6677 i 6678 ].join(''); 6679 }); 6680 6681 return media; 6682 } 6678 instances : 0 6683 6679 }); 6684 6680 … … 6699 6695 6700 6696 setMedia: function() { 6701 var className = '.wp-audio-shortcode', 6702 audio; 6703 6704 audio = this.$( className ); 6697 var audio = this.$('.wp-audio-shortcode'); 6705 6698 6706 6699 if ( audio.find( 'source' ).length ) { … … 6708 6701 audio.show(); 6709 6702 } 6710 6711 audio = audio.get(0); 6712 6713 if ( $( className ).length > 0 ) { 6714 audio = media.view.MediaDetails.prepareSrc( audio ); 6715 } 6716 6717 this.media = audio; 6703 this.media = this.prepareSrc( audio.get(0) ); 6718 6704 } else { 6719 6705 audio.hide(); … … 6741 6727 6742 6728 setMedia: function() { 6743 var className = '.wp-video-shortcode', 6744 video, 6745 yt; 6746 6747 video = this.$( className ); 6748 yt = video.hasClass('youtube-video'); 6729 var video = this.$('.wp-video-shortcode'); 6749 6730 6750 6731 if ( video.find( 'source' ).length ) { … … 6753 6734 } 6754 6735 6755 video = video.get(0);6756 6757 if ( ! yt ){6758 video = media.view.MediaDetails.prepareSrc( video);6736 if ( ! video.hasClass('youtube-video') ) { 6737 this.media = this.prepareSrc( video.get(0) ); 6738 } else { 6739 this.media = video.get(0); 6759 6740 } 6760 6761 this.media = video;6762 6741 } else { 6763 6742 video.hide(); -
trunk/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
r27528 r27530 26 26 27 27 function replaceAVShortcodes( content ) { 28 var testRegex = /\[(video-playlist| playlist)[^\]]*\]/,29 replaceRegex = /\[(video-playlist| playlist)[^\]]*\]([\s\S]*?\[\/\1\])?/;28 var testRegex = /\[(video-playlist|audio|video|playlist)[^\]]*\]/, 29 replaceRegex = /\[(video-playlist|audio|video|playlist)[^\]]*\]([\s\S]*?\[\/\1\])?/; 30 30 31 31 while ( testRegex.test( content ) ) { … … 93 93 frame.detach(); 94 94 }); 95 } else if ( editor.dom.hasClass( node, 'wp-video' ) ) { 96 frame = wp.media.video.edit( data ); 97 frame.on( 'close', function () { 98 frame.detach(); 99 } ); 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 ); 108 frame.open(); 109 } else if ( editor.dom.hasClass( node, 'wp-audio' ) ) { 110 frame = wp.media.audio.edit( data ); 111 frame.on( 'close', function () { 112 frame.detach(); 113 } ); 114 frame.state( 'audio-details' ).on( 'update replace add-source', function ( selection ) { 115 var shortcode = wp.media.audio.shortcode( selection ); 116 editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) ); 117 frame.detach(); 118 } ); 119 frame.open(); 95 120 } else { 96 121 // temp -
trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
r27528 r27530 238 238 * Gallery preview 239 239 */ 240 .wpview-type-gallery, 241 .wpview-type-audio, 242 .wpview-type-video { 240 .wpview-type-gallery { 243 241 position: relative; 244 242 padding: 0 0 12px; … … 247 245 } 248 246 249 .wpview-type-audio { 250 padding: 32px 0 0; 251 } 252 253 .wpview-type-video { 254 padding: 16px 0 0; 255 } 256 257 .wpview-type-audio audio, 258 .wpview-type-video video { 259 display: inline-block; 260 max-width: 100%; 261 } 262 263 .wpview-type-gallery:after, 264 .wpview-type-audio:after, 265 .wpview-type-video:after { 247 .wpview-type-gallery:after { 266 248 content: ''; 267 249 display: block; … … 271 253 } 272 254 273 .wpview-type-gallery.selected {255 .wpview-type-gallery.selected { 274 256 background-color: #efefef; 275 257 } 276 258 277 .wpview-type-audio, 278 .wpview-type-video { 279 background-color: #efefef; 280 } 281 282 .wpview-type-gallery .toolbar, 283 .wpview-type-audio .toolbar, 284 .wpview-type-video .toolbar { 259 .wpview-type-gallery .toolbar { 285 260 position: absolute; 286 261 top: 0; … … 290 265 padding: 4px; 291 266 display: none; 292 z-index: 100;293 }294 295 .wpview-type-audio .toolbar,296 .wpview-type-video .toolbar {297 display: block;298 267 } 299 268 … … 302 271 } 303 272 304 .wpview-type-gallery .toolbar span, 305 .wpview-type-audio .toolbar span 306 .wpview-type-video .toolbar span { 273 .wpview-type-gallery .toolbar span { 307 274 cursor: pointer; 308 275 } -
trunk/src/wp-includes/media-template.php
r27528 r27530 7 7 * @since 3.5.0 8 8 */ 9 10 /**11 * Output the markup for a audio tag to be used in an Underscore template12 * when data.model is passed.13 *14 * @since 3.9.015 */16 function wp_underscore_audio_template() {17 $audio_types = wp_get_audio_extensions();18 ?>19 <audio controls20 class="wp-audio-shortcode"21 preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"22 <#23 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):24 ?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {25 #> <?php echo $attr ?><#26 }27 <?php endforeach ?>#>28 >29 <# if ( ! _.isEmpty( data.model.src ) ) { #>30 <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />31 <# } #>32 33 <?php foreach ( $audio_types as $type ):34 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>35 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />36 <# } #>37 <?php endforeach;38 ?></audio>39 <?php40 }41 42 /**43 * Output the markup for a video tag to be used in an Underscore template44 * when data.model is passed.45 *46 * @since 3.9.047 */48 function wp_underscore_video_template( $onload = false ) {49 $video_types = wp_get_video_extensions();50 ?>51 <#52 var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);53 w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,54 h = ! data.model.height ? 360 : data.model.height;55 56 if ( data.model.width && w !== data.model.width ) {57 h = Math.ceil( ( h * w ) / data.model.width );58 }59 #>60 <video controls61 class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"62 width="{{ w }}"63 height="{{ h }}"64 <?php65 $props = array( 'poster' => '', 'preload' => 'metadata' );66 foreach ( $props as $key => $value ):67 if ( empty( $value ) ) {68 ?><#69 if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {70 #> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#71 } #>72 <?php } else {73 echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php74 }75 endforeach;76 ?><#77 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ):78 ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {79 #> <?php echo $attr ?><#80 }81 <?php endforeach ?>#>82 >83 <# if ( ! _.isEmpty( data.model.src ) ) {84 if ( isYouTube ) { #>85 <source src="{{ data.model.src }}" type="video/youtube" />86 <# } else { #>87 <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />88 <# }89 } #>90 91 <?php foreach ( $video_types as $type ):92 ?><# if ( data.model.<?php echo $type ?> ) { #>93 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />94 <# } #>95 <?php endforeach; ?>96 {{{ data.model.content }}}97 </video>98 <?php99 }100 9 101 10 /** … … 768 677 <div class="embed-media-settings embed-audio-settings"> 769 678 <div class="instructions media-instructions">{{{ wp.media.view.l10n.audioDetailsText }}}</div> 770 <?php wp_underscore_audio_template() ?> 679 <audio controls 680 class="wp-audio-shortcode" 681 preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}" 682 <# 683 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ): 684 ?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) { 685 #> <?php echo $attr ?><# 686 } 687 <?php endforeach ?>#> 688 > 689 <# if ( ! _.isEmpty( data.model.src ) ) { #> 690 <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" /> 691 <# } #> 692 693 <?php foreach ( $audio_types as $type ): 694 ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #> 695 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" /> 696 <# } #> 697 <?php endforeach; 698 ?></audio> 771 699 <# if ( ! _.isEmpty( data.model.src ) ) { #> 772 700 <label class="setting"> … … 811 739 </script> 812 740 813 <script type="text/html" id="tmpl-editor-audio">814 <div class="toolbar">815 <div class="dashicons dashicons-format-audio edit"></div>816 <div class="dashicons dashicons-no-alt remove"></div>817 </div>818 <?php wp_underscore_audio_template() ?>819 </script>820 821 741 <script type="text/html" id="tmpl-video-details"> 822 742 <?php $video_types = wp_get_video_extensions(); ?> … … 825 745 <div class="instructions media-instructions">{{{ wp.media.view.l10n.videoDetailsText }}}</div> 826 746 <div class="wp-video-holder"> 827 <?php wp_underscore_video_template() ?> 747 <# 748 var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/); 749 w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width, 750 h = ! data.model.height ? 360 : data.model.height; 751 752 if ( data.model.width && w !== data.model.width ) { 753 h = Math.ceil( ( h * w ) / data.model.width ); 754 } 755 756 #> 757 <video controls 758 class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}" 759 width="{{ w }}" 760 height="{{ h }}" 761 <?php 762 $props = array( 'poster' => '', 'preload' => 'metadata' ); 763 foreach ( $props as $key => $value ): 764 if ( empty( $value ) ) { 765 ?><# 766 if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) { 767 #> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<# 768 } #> 769 <?php } else { 770 echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php 771 } 772 endforeach; 773 ?><# 774 <?php foreach ( array( 'autoplay', 'loop' ) as $attr ): 775 ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) { 776 #> <?php echo $attr ?><# 777 } 778 <?php endforeach ?>#> 779 > 780 <# if ( ! _.isEmpty( data.model.src ) ) { 781 if ( isYouTube ) { #> 782 <source src="{{ data.model.src }}" type="video/youtube" /> 783 <# } else { #> 784 <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" /> 785 <# } 786 } #> 787 788 <?php foreach ( $video_types as $type ): 789 ?><# if ( data.model.<?php echo $type ?> ) { #> 790 <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" /> 791 <# } #> 792 <?php endforeach; ?> 793 {{{ data.model.content }}} 794 </video> 828 795 <# if ( ! _.isEmpty( data.model.src ) ) { #> 829 796 <label class="setting"> … … 891 858 </div> 892 859 </script> 893 894 <script type="text/html" id="tmpl-editor-video">895 <div class="toolbar">896 <div class="dashicons dashicons-format-video edit"></div>897 <div class="dashicons dashicons-no-alt remove"></div>898 </div>899 <?php wp_underscore_video_template() ?>900 </script>901 860 <?php 902 861
Note: See TracChangeset
for help on using the changeset viewer.