X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fadvhr%2Feditor_plugin_src.js;h=0c652d3303e8bf9a6136dbc7ff1811baaf3e4e44;hb=50511759c152f4ca2e22fb39a9bf31fc9f9d916d;hp=a4e1e8fb47070bfdfe7ff2eaa2765929e44cfd95;hpb=a66abf6cce7aa581b58007438671d7196a9d9f99;p=citadel.git diff --git a/webcit/tiny_mce/plugins/advhr/editor_plugin_src.js b/webcit/tiny_mce/plugins/advhr/editor_plugin_src.js index a4e1e8fb4..0c652d330 100644 --- a/webcit/tiny_mce/plugins/advhr/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/advhr/editor_plugin_src.js @@ -1,74 +1,57 @@ -/* Import plugin specific language pack */ -tinyMCE.importPluginLanguagePack('advhr', 'en,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,no,hu'); - -function TinyMCE_advhr_getInfo() { - return { - longname : 'Advanced HR', - author : 'Moxiecode Systems', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_advhr.html', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; -}; - -function TinyMCE_advhr_getControlHTML(control_name) { - switch (control_name) { - case "advhr": - return ''; - } - - return ""; -} - /** - * Executes the mceAdvanceHr command. + * editor_plugin_src.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ -function TinyMCE_advhr_execCommand(editor_id, element, command, user_interface, value) { - // Handle commands - switch (command) { - case "mceAdvancedHr": - var template = new Array(); - - template['file'] = '../../plugins/advhr/rule.htm'; // Relative to theme - template['width'] = 270; - template['height'] = 180; - - template['width'] += tinyMCE.getLang('lang_advhr_delta_width', 0); - template['height'] += tinyMCE.getLang('lang_advhr_delta_height', 0); - - var size = "", width = "", noshade = ""; - if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "hr"){ - tinyMCE.hrElement = tinyMCE.selectedElement; - if (tinyMCE.hrElement) { - size = tinyMCE.hrElement.getAttribute('size') ? tinyMCE.hrElement.getAttribute('size') : ""; - width = tinyMCE.hrElement.getAttribute('width') ? tinyMCE.hrElement.getAttribute('width') : ""; - noshade = tinyMCE.hrElement.getAttribute('noshade') ? tinyMCE.hrElement.getAttribute('noshade') : ""; - } - tinyMCE.openWindow(template, {editor_id : editor_id, size : size, width : width, noshade : noshade, mceDo : 'update'}); - } else { - if (tinyMCE.isMSIE) { - tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false,'
'); - } else { - tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", size : size, width : width, noshade : noshade, mceDo : 'insert'}); - } - } - - return true; - } - // Pass to next handler in chain - return false; -} - -function TinyMCE_advhr_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { - tinyMCE.switchClassSticky(editor_id + '_advhr', 'mceButtonNormal'); - - if (node == null) - return; - - do { - if (node.nodeName.toLowerCase() == "hr") - tinyMCE.switchClassSticky(editor_id + '_advhr', 'mceButtonSelected'); - } while ((node = node.parentNode)); - return true; -} \ No newline at end of file +(function() { + tinymce.create('tinymce.plugins.AdvancedHRPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvancedHr', function() { + ed.windowManager.open({ + file : url + '/rule.htm', + width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)), + height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('advhr', { + title : 'advhr.advhr_desc', + cmd : 'mceAdvancedHr' + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('advhr', n.nodeName == 'HR'); + }); + + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'HR') + ed.selection.select(e); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced HR', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin); +})(); \ No newline at end of file