/** * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ /* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('preview'); var TinyMCE_PreviewPlugin = { getInfo : function() { return { longname : 'Preview', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion }; }, /** * Returns the HTML contents of the preview control. */ getControlHTML : function(cn) { switch (cn) { case "preview": return tinyMCE.getButtonHTML(cn, 'lang_preview_desc', '{$pluginurl}/images/preview.gif', 'mcePreview'); } return ""; }, /** * Executes the mcePreview command. */ execCommand : function(editor_id, element, command, user_interface, value) { // Handle commands switch (command) { case "mcePreview": var previewPage = tinyMCE.getParam("plugin_preview_pageurl", null); var previewWidth = tinyMCE.getParam("plugin_preview_width", "550"); var previewHeight = tinyMCE.getParam("plugin_preview_height", "600"); // Use a custom preview page if (previewPage) { var template = new Array(); template['file'] = previewPage; template['width'] = previewWidth; template['height'] = previewHeight; tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "yes", inline : "yes", content : tinyMCE.getContent(), content_css : tinyMCE.getParam("content_css")}); } else { var win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + previewWidth + ",height=" + previewHeight); var html = "", i; var c = tinyMCE.getContent(); var pos = c.indexOf('
', pos); pos2 = c.lastIndexOf(''); c = c.substring(pos + 1, pos2); } html += tinyMCE.getParam('doctype'); html += ''; html += ''; html += '