TinyMCE wpView sandbox iframes:

- Make them transparent.
- Don't load tons of unrelated styles that can break them. This could result in minimal styling mismatch to the front-end, but keeps the views working well and looking good.
Props avryl, fixes #29048.

git-svn-id: https://develop.svn.wordpress.org/trunk@29543 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-08-19 21:52:19 +00:00
parent 9eaf6cda94
commit d8fac44995
2 changed files with 14 additions and 13 deletions

View File

@ -156,8 +156,18 @@ window.wp = window.wp || {};
'<html>' +
'<head>' +
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
'<style>' +
'html, body#wpview-iframe-sandbox {' +
'background: transparent;' +
'padding: 0;' +
'margin: 0;' +
'}' +
'body#wpview-iframe-sandbox {' +
'padding: 1px 0;' +
'}' +
'</style>' +
'</head>' +
'<body data-context="iframe-sandbox" style="padding: 0; margin: 0;" class="' + editor.getBody().className + '">' +
'<body id="wpview-iframe-sandbox">' +
html +
'</body>' +
'</html>'
@ -166,7 +176,7 @@ window.wp = window.wp || {};
resize = function() {
// Make sure the iframe still exists.
iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).height() );
iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).outerHeight() );
};
if ( MutationObserver ) {

View File

@ -3310,18 +3310,9 @@ function attachment_url_to_postid( $url ) {
*/
function wp_media_mce_styles() {
$version = 'ver=' . $GLOBALS['wp_version'];
$tinymce = includes_url( "js/tinymce/skins/lightgray/content.min.css?$version" );
$dashicons = includes_url( "css/dashicons.css?$version" );
$skin = includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
$mce_styles = array( $tinymce, $dashicons, $skin, $mediaelement, $wpmediaelement );
$editor_styles = get_editor_stylesheets();
if ( ! empty( $editor_styles ) ) {
foreach ( $editor_styles as $style ) {
$mce_styles[] = $style;
}
}
return $mce_styles;
}
return array( $dashicons, $mediaelement, $wpmediaelement );
}