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.

Built from https://develop.svn.wordpress.org/trunk@29615


git-svn-id: http://core.svn.wordpress.org/trunk@29389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2014-08-26 04:46:15 +00:00
parent e051fe3341
commit 149346ff6e
8 changed files with 73 additions and 41 deletions

View File

@@ -260,7 +260,8 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
editor.on( 'init', function() {
var scrolled = false,
selection = editor.selection;
selection = editor.selection,
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
// When a view is selected, ensure content that is being pasted
// or inserted is added to a text node (instead of the view).
@@ -333,6 +334,16 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
scrolled = false;
}
}, true );
if ( MutationObserver ) {
new MutationObserver( function() {
editor.fire( 'wp-body-class-change' );
} )
.observe( editor.getBody(), {
attributes: true,
attributeFilter: ['class']
} );
}
});
editor.on( 'PreProcess', function( event ) {

File diff suppressed because one or more lines are too long