X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fnoneditable%2Feditor_plugin_src.js;h=916dce29cfc37bd755c724d36cb5f9ffa5fbfd83;hb=b05f4eef4014db3885787ef15107cba93c932ac9;hp=df3000c5c87c15c73efbf50816944773c783484e;hpb=932f4feaa7b2afe4553e5e669e2312614d3f6140;p=citadel.git diff --git a/webcit/tiny_mce/plugins/noneditable/editor_plugin_src.js b/webcit/tiny_mce/plugins/noneditable/editor_plugin_src.js old mode 100755 new mode 100644 index df3000c5c..916dce29c --- a/webcit/tiny_mce/plugins/noneditable/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/noneditable/editor_plugin_src.js @@ -1,153 +1,95 @@ /** - * $Id: editor_plugin_src.js 205 2007-02-12 18:58:29Z spocke $ + * editor_plugin_src.js * - * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ -var TinyMCE_NonEditablePlugin = { - getInfo : function() { - return { - longname : 'Non editable elements', - author : 'Moxiecode Systems AB', - authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', - version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion - }; - }, - - initInstance : function(inst) { - tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/noneditable/css/noneditable.css"); - - // Ugly hack - if (tinyMCE.isMSIE5_0) - tinyMCE.settings['plugins'] = tinyMCE.settings['plugins'].replace(/noneditable/gi, 'Noneditable'); - }, - - handleEvent : function(e) { - return this._moveSelection(e, tinyMCE.selectedInstance); - }, - - cleanup : function(type, content, inst) { - switch (type) { - case "insert_to_editor_dom": - var nodes, i, editClass, nonEditClass, editable, elm; - - // Pass through Gecko - if (tinyMCE.isGecko) - return content; - - nodes = tinyMCE.getNodeTree(content, [], 1); - - editClass = tinyMCE.getParam("noneditable_editable_class", "mceEditable"); - nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceNonEditable"); - - for (i=0; i 32 && k < 41) || (k > 111 && k < 124)) + return; + + return Event.cancel(e); + }, + + _setDisabled : function(s) { + var t = this, ed = t.editor; + + tinymce.each(ed.controlManager.controls, function(c) { + c.setDisabled(s); + }); + + if (s !== t.disabled) { + if (s) { + ed.onKeyDown.addToTop(t._block); + ed.onKeyPress.addToTop(t._block); + ed.onKeyUp.addToTop(t._block); + ed.onPaste.addToTop(t._block); + ed.onContextMenu.addToTop(t._block); + } else { + ed.onKeyDown.remove(t._block); + ed.onKeyPress.remove(t._block); + ed.onKeyUp.remove(t._block); + ed.onPaste.remove(t._block); + ed.onContextMenu.remove(t._block); } - s.removeAllRanges(); - s.addRange(r); - - return tinyMCE.cancelEvent(e); + t.disabled = s; } } + }); - return true; - }, - - _setEditable : function(elm, state) { - var editClass = tinyMCE.getParam("noneditable_editable_class", "mceEditable"); - var nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceNonEditable"); - - var className = elm.className ? elm.className : ""; - - if (className.indexOf(editClass) != -1 || className.indexOf(nonEditClass) != -1) - return; - - if ((className = tinyMCE.getAttrib(elm, "class")) != "") - className += " "; - - className += state ? editClass : nonEditClass; - - elm.setAttribute("class", className); - elm.className = className; - } -}; - -tinyMCE.addPlugin("noneditable", TinyMCE_NonEditablePlugin); + // Register plugin + tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin); +})(); \ No newline at end of file