1 /* Import plugin specific language pack */
2 tinyMCE.importPluginLanguagePack('preview', 'cs,de,el,en,fr_ca,it,ko,pt,sv,zh_cn,fa,fr,pl,pt_br,nl,da,he,no,hu');
4 function TinyMCE_preview_getInfo() {
7 author : 'Moxiecode Systems',
8 authorurl : 'http://tinymce.moxiecode.com',
9 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_preview.html',
10 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
15 * Returns the HTML contents of the preview control.
17 function TinyMCE_preview_getControlHTML(control_name) {
18 switch (control_name) {
20 return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcePreview\');" target="_self" onmousedown="return false;"><img id="{$editor_id}_preview" src="{$pluginurl}/images/preview.gif" title="{$lang_preview_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
27 * Executes the mcePreview command.
29 function TinyMCE_preview_execCommand(editor_id, element, command, user_interface, value) {
33 var previewPage = tinyMCE.getParam("plugin_preview_pageurl", null);
34 var previewWidth = tinyMCE.getParam("plugin_preview_width", "550");
35 var previewHeight = tinyMCE.getParam("plugin_preview_height", "600");
37 // Use a custom preview page
39 var template = new Array();
41 template['file'] = previewPage;
42 template['width'] = previewWidth;
43 template['height'] = previewHeight;
45 tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes", inline : "yes", content : tinyMCE.getContent(), content_css : tinyMCE.getParam("content_css")});
47 var win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + previewWidth + ",height=" + previewHeight);
50 html += '<!doctype html public "-//w3c//dtd html 4.0 transitional//en">';
53 html += '<title>' + tinyMCE.getLang('lang_preview_desc') + '</title>';
54 html += '<base href="' + tinyMCE.getParam("document_base_url") + '">';
55 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
56 html += '<link href="' + tinyMCE.getParam("content_css") + '" rel="stylesheet" type="text/css">';
59 html += tinyMCE.getContent();
63 win.document.write(html);