diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/preview/editor_plugin_src.js --- a/includes/clientside/tinymce/plugins/preview/editor_plugin_src.js Wed Dec 26 00:37:26 2007 -0500 +++ b/includes/clientside/tinymce/plugins/preview/editor_plugin_src.js Thu Dec 27 22:09:33 2007 -0500 @@ -1,205 +1,190 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * $Id: editor_plugin_src.js 444 2007-11-26 16:17:54Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('preview'); +(function() { + tinymce.create('tinymce.plugins.Preview', { + init : function(ed, url) { + var t = this; -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 - }; - }, + t.editor = ed; + + ed.addCommand('mcePreview', t._preview, t); + ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'}); + }, - /** - * 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 ""; - }, + 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 + }; + }, - /** - * 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"); + // Private methods - // Use a custom preview page - if (previewPage) { - var template = new Array(); + _preview : function() { + var ed = this.editor, win, html, c, pos, pos2, css, i, page = ed.getParam("plugin_preview_pageurl", null), w = ed.getParam("plugin_preview_width", "550"), h = ed.getParam("plugin_preview_height", "600"); - 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); - } + // Use a custom preview page + if (page) { + ed.windowManager.open({ + file : ed.getParam("plugin_preview_pageurl", null), + width : w, + height : h + }, { + editor_id : editor_id, + resizable : "yes", + scrollbars : "yes", + inline : 1, + content : ed.getContent(), + content_css : ed.getParam("content_css") + }); + } else { + win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + w + ",height=" + h); + html = ""; + c = ed.getContent(); + pos = c.indexOf(''; - html += ''; - html += ''; - - for (i=0; i'; + tinymce.map(css, function(u) { + return ed.documentBaseURI.toAbsolute(u); + }); - html += ''; - html += ''; - html += ''; - html += c; - html += ''; - html += ''; - - win.document.write(html); - win.document.close(); + if (pos != -1) { + pos = c.indexOf('>', pos); + pos2 = c.lastIndexOf(''); + c = c.substring(pos + 1, pos2); } - return true; - } + html += ed.getParam('doctype'); + html += ''; + html += ''; + html += '' + ed.getLang('preview.preview_desc') + ''; + html += ''; + html += ''; - return false; - }, - - _setDoc : function(d) { - TinyMCE_PreviewPlugin._doc = d; - d._embeds = new Array(); - }, + for (i=0; i'; - _setWin : function(d) { - TinyMCE_PreviewPlugin._win = d; - }, - - _onLoad : function() { - var nl, i, el = new Array(), d = TinyMCE_PreviewPlugin._doc, sv, ne; + html += ''; + html += ''; + html += c; + html += ''; + html += ''; - nl = d.getElementsByTagName("script"); - for (i=0; i'; + for (n in p) + h += ''; + + h += '