X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpreview%2Fplugin.js;h=12a1683e5341c33a2c3550aebfc9c77921a28d57;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=2238f920e74e09653a7279a91ad0a4e16e1c8702;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/preview/plugin.js b/_source/plugins/preview/plugin.js index 2238f92..12a1683 100644 --- a/_source/plugins/preview/plugin.js +++ b/_source/plugins/preview/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -16,19 +16,29 @@ For licensing, see LICENSE.html or http://ckeditor.com/license exec : function( editor ) { var sHTML, - isCustomDomain = CKEDITOR.env.ie && document.domain != window.location.hostname; - if ( editor.config.fullPage ) - sHTML = editor.getData(); + config = editor.config, + baseTag = config.baseHref ? '' : '', + isCustomDomain = CKEDITOR.env.isCustomDomain(); + + if ( config.fullPage ) + { + sHTML = editor.getData() + .replace( //, '$&' + baseTag ) + .replace( /[^>]*(?=<\/title>)/, '$& — ' + editor.lang.preview ); + } else { var bodyHtml = ' 0 ) ? '' : ''; + body = editor.document && editor.document.getBody(); + + if ( body ) + { + if ( body.getAttribute( 'id' ) ) + bodyHtml += 'id="' + body.getAttribute( 'id' ) + '" '; + if ( body.getAttribute( 'class' ) ) + bodyHtml += 'class="' + body.getAttribute( 'class' ) + '" '; + } - if ( body.getAttribute( 'id' ) ) - bodyHtml += 'id="' + body.getAttribute( 'id' ) + '" '; - if ( body.getAttribute( 'class' ) ) - bodyHtml += 'class="' + body.getAttribute( 'class' ) + '" '; bodyHtml += '>'; sHTML = @@ -37,7 +47,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license '' + baseTag + '' + editor.lang.preview + '' + - '' + + CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) + '' + bodyHtml + editor.getData() + ''; @@ -73,6 +83,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( !isCustomDomain ) { + oWindow.document.open(); oWindow.document.write( sHTML ); oWindow.document.close(); }