Changeset 28358
- Timestamp:
- 05/10/2014 11:35:08 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/admin-ajax.php
r28126 r28358 59 59 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 60 60 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 61 'save-user-color-scheme', 'update-widget', 'query-themes', 61 'save-user-color-scheme', 'update-widget', 'query-themes', 'filter-content' 62 62 ); 63 63 -
trunk/src/wp-admin/includes/ajax-actions.php
r28356 r28358 2507 2507 wp_send_json_success( $api ); 2508 2508 } 2509 2510 /** 2511 * Apply `the_content` filters to a string based on the post ID. 2512 * 2513 * @since 4.0.0 2514 */ 2515 function wp_ajax_filter_content() { 2516 global $post; 2517 2518 if ( ! $post = get_post( (int) $_REQUEST['post_ID'] ) ) { 2519 wp_send_json_error(); 2520 } 2521 2522 if ( ! current_user_can( 'read_post', $post->ID ) ) { 2523 wp_send_json_error(); 2524 } 2525 2526 setup_postdata( $post ); 2527 2528 wp_send_json_success( apply_filters( 'the_content', wp_unslash( $_POST['content'] ) ) ); 2529 } -
trunk/src/wp-includes/js/mce-view.js
r28183 r28358 355 355 wp.mce.media = { 356 356 loaded: false, 357 /** 358 * @global wp.shortcode 359 * 360 * @param {string} content 361 * @returns {Object} 362 */ 363 toView: function( content ) { 364 var match = wp.shortcode.next( this.shortcode, content ); 365 366 if ( ! match ) { 367 return; 368 } 369 370 return { 371 index: match.index, 372 content: match.content, 373 options: { 374 shortcode: match.shortcode 375 } 376 }; 377 }, 357 toView: wp.mce.gallery.toView, 378 358 379 359 /** … … 691 671 } ); 692 672 wp.mce.views.register( 'playlist', wp.mce.playlist ); 673 674 wp.mce.embed = { 675 shortcode: 'embed', 676 toView: wp.mce.gallery.toView, 677 View: wp.mce.View.extend( { 678 className: 'editor-embed', 679 template: media.template( 'editor-embed' ), 680 initialize: function( options ) { 681 this.players = []; 682 this.content = options.content; 683 this.parsed = false; 684 this.shortcode = options.shortcode; 685 _.bindAll( this, 'setHtml', 'setNode', 'fetch' ); 686 $( this ).on( 'ready', this.setNode ); 687 }, 688 unbind: function() { 689 var self = this; 690 this.pauseAllPlayers(); 691 _.each( this.players, function ( player ) { 692 self.removePlayer( player ); 693 } ); 694 this.players = []; 695 }, 696 setNode: function ( e, node ) { 697 this.node = node; 698 if ( this.parsed ) { 699 this.parseMediaShortcodes(); 700 } else { 701 this.fetch(); 702 } 703 }, 704 fetch: function () { 705 wp.ajax.send( 'filter-content', { 706 data: { 707 post_ID: $( '#post_ID' ).val(), 708 content: this.shortcode.string() 709 } 710 } ).done( this.setHtml ); 711 }, 712 setHtml: function ( content ) { 713 var scripts = $( content ).find( 'script' ); 714 715 this.parsed = content; 716 717 $( this.node ).html( this.getHtml() ); 718 if ( scripts ) { 719 _.each( scripts, function (script) { 720 var element = document.createElement( 'script' ); 721 element.type = 'text/javascript'; 722 element.src = script.src; 723 tinymce.activeEditor.contentDocument.getElementsByTagName( 'head' )[0].appendChild( element ); 724 } ); 725 } 726 this.parseMediaShortcodes(); 727 }, 728 parseMediaShortcodes: function () { 729 var self = this; 730 $( '.wp-audio-shortcode, .wp-video-shortcode', this.node ).each( function ( i, element ) { 731 self.players.push( new MediaElementPlayer( element, self.mejsSettings ) ); 732 } ); 733 }, 734 getHtml: function() { 735 if ( ! this.parsed ) { 736 return ''; 737 } 738 return this.template({ content: this.parsed }); 739 } 740 } ), 741 edit: function() {} 742 }; 743 744 _.extend( wp.mce.embed.View.prototype, wp.media.mixin ); 745 746 wp.mce.views.register( 'embed', wp.mce.embed ); 747 693 748 }(jQuery)); -
trunk/src/wp-includes/js/media-audiovideo.js
r28182 r28358 132 132 var featureIndex, feature; 133 133 134 if ( ! t.options ) { 135 return; 136 } 137 134 138 // invoke features cleanup 135 139 for ( featureIndex in t.options.features ) { -
trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
r28183 r28358 168 168 event.content = wp.mce.views.toViews( event.content ); 169 169 }); 170 171 editor.on( 'PastePreProcess', function( event ) { 172 if ( event.content.match( /^\s*(https?:\/\/[^\s"]+)\s*$/im ) ) { 173 event.content = '[embed]' + event.content + '[/embed]'; 174 } 175 } ); 170 176 171 177 // When the editor's content has been updated and the DOM has been -
trunk/src/wp-includes/media-template.php
r28343 r28358 1046 1046 </script> 1047 1047 1048 <script type="text/html" id="tmpl-editor-embed"> 1049 <div class="toolbar"> 1050 <div class="dashicons dashicons-no-alt remove"></div> 1051 </div> 1052 {{{ data.content }}} 1053 <div class="wpview-overlay"></div> 1054 </script> 1055 1048 1056 <?php 1049 1057
Note: See TracChangeset
for help on using the changeset viewer.