WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/26/2014 04:45:54 AM (6 years ago)
Author:
wonderboymusic
Message:

MCE View sandboxes:

  • Use a MutationObserver to listen to the body class of the parent editor frame.
  • In wpview_media_sandbox_styles(), only return the MEjs stylesheets.
  • In wp_ajax_parse_media_shortcode() and wp_ajax_parse_embed(), return an object instead of an HTML blob to allow passing body and head separately

Props avryl, azaozz.
Fixes #29048.

File:
1 edited

Legend:

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

    r29577 r29615  
    27062706    }
    27072707
    2708     wp_send_json_success( $parsed );
     2708    wp_send_json_success( array(
     2709        'body' => $parsed
     2710    ) );
    27092711}
    27102712
     
    27302732    }
    27312733
    2732     ob_start();
    2733 
     2734    $head = '';
    27342735    $styles = wpview_media_sandbox_styles();
     2736
    27352737    foreach ( $styles as $style ) {
    2736         printf( '<link rel="stylesheet" href="%s"/>', $style );
    2737     }
    2738 
    2739     echo $shortcode;
     2738        $head .= '<link type="text/css" rel="stylesheet" href="' . $style . '">';
     2739    }
    27402740
    27412741    if ( ! empty( $wp_scripts ) ) {
    27422742        $wp_scripts->done = array();
    27432743    }
     2744
     2745    ob_start();
     2746
     2747    echo $shortcode;
    27442748
    27452749    if ( 'playlist' === $_REQUEST['type'] ) {
     
    27512755    }
    27522756
    2753     wp_send_json_success( ob_get_clean() );
    2754 }
     2757    wp_send_json_success( array(
     2758        'head' => $head,
     2759        'body' => ob_get_clean()
     2760    ) );
     2761}
Note: See TracChangeset for help on using the changeset viewer.