2 * $RCSfile: editor_plugin_src.js,v $
\r
4 * $Date: 2006/03/20 12:03:44 $
\r
7 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
\r
10 /* Import plugin specific language pack */
\r
11 tinyMCE.importPluginLanguagePack('preview', 'en,tr,cs,de,el,fr_ca,it,ko,pt,sv,zh_cn,fa,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk');
\r
13 var TinyMCE_PreviewPlugin = {
\r
14 getInfo : function() {
\r
16 longname : 'Preview',
\r
17 author : 'Moxiecode Systems',
\r
18 authorurl : 'http://tinymce.moxiecode.com',
\r
19 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_preview.html',
\r
20 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
\r
25 * Returns the HTML contents of the preview control.
\r
27 getControlHTML : function(cn) {
\r
30 return tinyMCE.getButtonHTML(cn, 'lang_preview_desc', '{$pluginurl}/images/preview.gif', 'mcePreview');
\r
37 * Executes the mcePreview command.
\r
39 execCommand : function(editor_id, element, command, user_interface, value) {
\r
43 var previewPage = tinyMCE.getParam("plugin_preview_pageurl", null);
\r
44 var previewWidth = tinyMCE.getParam("plugin_preview_width", "550");
\r
45 var previewHeight = tinyMCE.getParam("plugin_preview_height", "600");
\r
47 // Use a custom preview page
\r
49 var template = new Array();
\r
51 template['file'] = previewPage;
\r
52 template['width'] = previewWidth;
\r
53 template['height'] = previewHeight;
\r
55 tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes", inline : "yes", content : tinyMCE.getContent(), content_css : tinyMCE.getParam("content_css")});
\r
57 var win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + previewWidth + ",height=" + previewHeight);
\r
59 var c = tinyMCE.getContent();
\r
60 var pos = c.indexOf('<body'), pos2;
\r
63 pos = c.indexOf('>', pos);
\r
64 pos2 = c.lastIndexOf('</body>');
\r
65 c = c.substring(pos + 1, pos2);
\r
68 html += tinyMCE.getParam('doctype');
\r
69 html += '<html xmlns="http://www.w3.org/1999/xhtml">';
\r
71 html += '<title>' + tinyMCE.getLang('lang_preview_desc') + '</title>';
\r
72 html += '<base href="' + tinyMCE.settings['base_href'] + '" />';
\r
73 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
\r
74 html += '<link href="' + tinyMCE.getParam("content_css") + '" rel="stylesheet" type="text/css" />';
\r
76 html += '<body dir="' + tinyMCE.getParam("directionality") + '">';
\r
81 win.document.write(html);
\r
82 win.document.close();
\r
92 tinyMCE.addPlugin("preview", TinyMCE_PreviewPlugin);
\r