Changeset 41985
- Timestamp:
- 10/24/2017 04:06:23 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r41980 r41985 2994 2994 * @global WP_Embed $wp_embed Embed API instance. 2995 2995 * @global WP_Scripts $wp_scripts 2996 * @global int $content_width 2996 2997 */ 2997 2998 function wp_ajax_parse_embed() { 2998 global $post, $wp_embed ;2999 global $post, $wp_embed, $content_width; 2999 3000 3000 3001 if ( empty( $_POST['shortcode'] ) ) { … … 3035 3036 if ( ! $parsed ) { 3036 3037 $no_ssl_support = true; 3038 } 3039 } 3040 3041 // Set $content_width so any embeds fit in the destination iframe. 3042 if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { 3043 if ( ! isset( $content_width ) ) { 3044 $content_width = intval( $_POST['maxwidth'] ); 3045 } else { 3046 $content_width = min( $content_width, intval( $_POST['maxwidth'] ) ); 3037 3047 } 3038 3048 } -
trunk/src/wp-includes/js/mce-view.js
r41395 r41985 86 86 * 87 87 * @param {String} content The string to scan. 88 * @param {tinymce.Editor} editor The editor. 88 89 * 89 90 * @return {String} The string with markers. 90 91 */ 91 setMarkers: function( content ) {92 setMarkers: function( content, editor ) { 92 93 var pieces = [ { content: content } ], 93 94 self = this, … … 116 117 } 117 118 119 result.options.editor = editor; 118 120 instance = self.createInstance( type, result.content, result.options ); 119 121 text = instance.loader ? '.' : instance.text; … … 851 853 852 854 initialize: function() { 853 var self = this ;855 var self = this, maxwidth = null; 854 856 855 857 if ( this.url ) { … … 860 862 } 861 863 864 // Obtain the target width for the embed. 865 if ( self.editor ) { 866 maxwidth = self.editor.iframeElement.clientWidth - 20; // Minus the sum of horizontal margins and borders. 867 } 868 862 869 wp.ajax.post( this.action, { 863 870 post_ID: media.view.settings.post.id, 864 871 type: this.shortcode.tag, 865 shortcode: this.shortcode.string() 872 shortcode: this.shortcode.string(), 873 maxwidth: maxwidth 866 874 } ) 867 875 .done( function( response ) { -
trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
r40583 r41985 89 89 } 90 90 91 event.content = wp.mce.views.setMarkers( event.content );91 event.content = wp.mce.views.setMarkers( event.content, editor ); 92 92 } ); 93 93
Note: See TracChangeset
for help on using the changeset viewer.