5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
9 var Event = tinymce.dom.Event;
11 tinymce.create('tinymce.plugins.NonEditablePlugin', {
12 init : function(ed, url) {
13 var t = this, editClass, nonEditClass;
16 editClass = ed.getParam("noneditable_editable_class", "mceEditable");
17 nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable");
19 ed.onNodeChange.addToTop(function(ed, cm, n) {
22 // Block if start or end is inside a non editable element
23 sc = ed.dom.getParent(ed.selection.getStart(), function(n) {
24 return ed.dom.hasClass(n, nonEditClass);
27 ec = ed.dom.getParent(ed.selection.getEnd(), function(n) {
28 return ed.dom.hasClass(n, nonEditClass);
40 getInfo : function() {
42 longname : 'Non editable elements',
43 author : 'Moxiecode Systems AB',
44 authorurl : 'http://tinymce.moxiecode.com',
45 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',
46 version : tinymce.majorVersion + "." + tinymce.minorVersion
50 _block : function(ed, e) {
53 // Don't block arrow keys, pg up/down, and F1-F12
54 if ((k > 32 && k < 41) || (k > 111 && k < 124))
57 return Event.cancel(e);
60 _setDisabled : function(s) {
61 var t = this, ed = t.editor;
63 tinymce.each(ed.controlManager.controls, function(c) {
67 if (s !== t.disabled) {
69 ed.onKeyDown.addToTop(t._block);
70 ed.onKeyPress.addToTop(t._block);
71 ed.onKeyUp.addToTop(t._block);
72 ed.onPaste.addToTop(t._block);
74 ed.onKeyDown.remove(t._block);
75 ed.onKeyPress.remove(t._block);
76 ed.onKeyUp.remove(t._block);
77 ed.onPaste.remove(t._block);
86 tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin);