X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpreview%2Fplugin.js;h=a31ebfad398bda0642ede38aadcc448316e6495f;hb=4e70ea24db840898be8cc21c950363a52a2a6aba;hp=6d3a369ca16c6aff4ed813e7f61f10c1043491d2;hpb=8761695d9b70afe75905deaac88f78c1f8aeb32d;p=ckeditor.git
diff --git a/_source/plugins/preview/plugin.js b/_source/plugins/preview/plugin.js
index 6d3a369..a31ebfa 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
*/
@@ -13,22 +13,33 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
{
modes : { wysiwyg:1, source:1 },
canUndo : false,
+ readOnly : 1,
exec : function( editor )
{
var sHTML,
+ config = editor.config,
+ baseTag = config.baseHref ? '' : '',
isCustomDomain = CKEDITOR.env.isCustomDomain();
- if ( editor.config.fullPage )
- sHTML = editor.getData();
+
+ 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,9 +48,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
'' +
baseTag +
'' + editor.lang.preview + '' +
- '' +
+ CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
'' + bodyHtml +
editor.getData() +
'';
@@ -75,6 +84,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
if ( !isCustomDomain )
{
+ oWindow.document.open();
oWindow.document.write( sHTML );
oWindow.document.close();
}