Index: openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js 25 Jan 2008 21:44:14 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js 8 May 2009 18:18:34 -0000 1.2 @@ -2,82 +2,51 @@ * $Id$ * * @author Moxiecode - * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. */ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('style'); +(function() { + tinymce.create('tinymce.plugins.StylePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceStyleProps', function() { + ed.windowManager.open({ + file : url + '/props.htm', + width : 480 + parseInt(ed.getLang('style.delta_width', 0)), + height : 320 + parseInt(ed.getLang('style.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + style_text : ed.selection.getNode().style.cssText + }); + }); -var TinyMCE_StylePlugin = { - getInfo : function() { - return { - longname : 'Style', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, + ed.addCommand('mceSetElementStyle', function(ui, v) { + if (e = ed.selection.getNode()) { + ed.dom.setAttrib(e, 'style', v); + ed.execCommand('mceRepaint'); + } + }); - getControlHTML : function(cn) { - switch (cn) { - case "styleprops": - return tinyMCE.getButtonHTML(cn, 'lang_style_styleinfo_desc', '{$pluginurl}/images/styleprops.gif', 'mceStyleProps', true); - } + ed.onNodeChange.add(function(ed, cm, n) { + cm.setDisabled('styleprops', n.nodeName === 'BODY'); + }); - return ""; - }, + // Register buttons + ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); + }, - execCommand : function(editor_id, element, command, user_interface, value) { - var e, inst; - - // Handle commands - switch (command) { - case "mceStyleProps": - TinyMCE_StylePlugin._styleProps(); - return true; - - case "mceSetElementStyle": - inst = tinyMCE.getInstanceById(editor_id); - e = inst.selection.getFocusElement(); - - if (e) { - e.style.cssText = value; - inst.repaint(); - } - - return true; + getInfo : function() { + return { + longname : 'Style', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; } + }); - // Pass to next handler in chain - return false; - }, - - handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { - if (node.nodeName == 'BODY') - tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonDisabled'); - else - tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonNormal'); - }, - - // Private plugin specific methods - - _styleProps : function() { - var e = tinyMCE.selectedInstance.selection.getFocusElement(); - - if (!e || e.nodeName == 'BODY') - return; - - tinyMCE.openWindow({ - file : '../../plugins/style/props.htm', - width : 480 + tinyMCE.getLang('lang_style_props_delta_width', 0), - height : 320 + tinyMCE.getLang('lang_style_props_delta_height', 0) - }, { - editor_id : tinyMCE.selectedInstance.editorId, - inline : "yes", - style_text : e.style.cssText - }); - } -}; - -tinyMCE.addPlugin("style", TinyMCE_StylePlugin); + // Register plugin + tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); +})(); \ No newline at end of file