Make WordPress Core


Ignore:
Timestamp:
10/24/2017 04:06:23 AM (7 years ago)
Author:
westonruter
Message:

Editor: Specify maxwidth in parse-embed requests based on width of editor iframe so that TinyMCE view embeds fit, particularly in Text widgets.

See #40854, #34115.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r41980 r41985  
    29942994 * @global WP_Embed   $wp_embed   Embed API instance.
    29952995 * @global WP_Scripts $wp_scripts
     2996 * @global int        $content_width
    29962997 */
    29972998function wp_ajax_parse_embed() {
    2998     global $post, $wp_embed;
     2999    global $post, $wp_embed, $content_width;
    29993000
    30003001    if ( empty( $_POST['shortcode'] ) ) {
     
    30353036        if ( ! $parsed ) {
    30363037            $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'] ) );
    30373047        }
    30383048    }
Note: See TracChangeset for help on using the changeset viewer.