TinyMCE wpViews: always import the non-default editor styles in the sandbox iframe in views.

Props iseulde, mattheu. Fixes #31464.
Built from https://develop.svn.wordpress.org/trunk@31742


git-svn-id: http://core.svn.wordpress.org/trunk@31723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-03-12 01:05:54 +00:00
parent 9f6cd01346
commit 04494a6c32
3 changed files with 18 additions and 24 deletions

View File

@ -461,8 +461,7 @@ window.wp = window.wp || {};
* @param {Boolean} rendered Only set for (un)rendered nodes. Optional.
*/
setIframes: function( head, body, callback, rendered ) {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist';
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
this.getNodes( function( editor, node, content ) {
// Seems Firefox needs a bit of time to insert/set the view nodes,
@ -473,21 +472,18 @@ window.wp = window.wp || {};
bodyClasses = editor.getBody().className || '',
iframe, iframeDoc, observer, i;
if ( importStyles ) {
if ( ! wp.mce.views.sandboxStyles ) {
tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) {
if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 ) {
styles += dom.getOuterHTML( link ) + '\n';
}
});
wp.mce.views.sandboxStyles = styles;
} else {
styles = wp.mce.views.sandboxStyles;
tinymce.each( dom.$(
'link[rel="stylesheet"]',
editor.getDoc().getElementsByTagName( 'head' )[0]
), function( link ) {
if (
link.href &&
link.href.indexOf( 'skins/lightgray/content.min.css' ) >= 0 &&
link.href.indexOf( 'skins/wordpress/wp-content.css' ) >= 0
) {
styles += dom.getOuterHTML( link );
}
}
} );
content.innerHTML = '';
@ -580,13 +576,11 @@ window.wp = window.wp || {};
iframeDoc.body.className = editor.getBody().className;
}
if ( importStyles ) {
editor.on( 'wp-body-class-change', classChange );
editor.on( 'wp-body-class-change', classChange );
$( node ).one( 'wp-mce-view-unbind', function() {
editor.off( 'wp-body-class-change', classChange );
} );
}
$( node ).one( 'wp-mce-view-unbind', function() {
editor.off( 'wp-body-class-change', classChange );
} );
callback && callback.apply( this, arguments );
}, 50 );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31741';
$wp_version = '4.2-alpha-31742';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.