diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/noneditable/editor_plugin_src.js --- a/includes/clientside/tinymce/plugins/noneditable/editor_plugin_src.js Wed Dec 26 00:37:26 2007 -0500 +++ b/includes/clientside/tinymce/plugins/noneditable/editor_plugin_src.js Thu Dec 27 22:09:33 2007 -0500 @@ -1,153 +1,81 @@ /** - * $Id: editor_plugin_src.js 205 2007-02-12 18:58:29Z spocke $ + * $Id: editor_plugin_src.js 372 2007-11-11 18:38:50Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ -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 - }; - }, +(function() { + var Event = tinymce.dom.Event; + + tinymce.create('tinymce.plugins.NonEditablePlugin', { + init : function(ed, url) { + var t = this, editClass, nonEditClass; - initInstance : function(inst) { - tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/noneditable/css/noneditable.css"); + t.editor = ed; + editClass = ed.getParam("noneditable_editable_class", "mceEditable"); + nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); + + ed.onNodeChange.addToTop(function(ed, cm, n) { + var sc, ec; - // Ugly hack - if (tinyMCE.isMSIE5_0) - tinyMCE.settings['plugins'] = tinyMCE.settings['plugins'].replace(/noneditable/gi, 'Noneditable'); - }, + // Block if start or end is inside a non editable element + sc = ed.dom.getParent(ed.selection.getStart(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); - handleEvent : function(e) { - return this._moveSelection(e, tinyMCE.selectedInstance); - }, + ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); - 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); + // Block or unblock + if (sc || ec) { + t._setDisabled(1); + return false; + } else + t._setDisabled(0); + }); + }, - editClass = tinyMCE.getParam("noneditable_editable_class", "mceEditable"); - nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceNonEditable"); - - for (i=0; i