diff options
| author | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
| commit | f61b5b0597e0c25f084ee67d402f12a43a7a9947 (patch) | |
| tree | 3b4c3f9f38637f1a7ecf703ece4fd3bc4c6e2934 /public/javascripts/tiny_mce/plugins/noneditable | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/noneditable')
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js | 87 |
2 files changed, 88 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js b/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js new file mode 100755 index 0000000..8a1b8f0 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.NonEditablePlugin',{init:function(ed,url){var t=this,editClass,nonEditClass;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;sc=ed.dom.getParent(ed.selection.getStart(),function(n){return ed.dom.hasClass(n,nonEditClass);});ec=ed.dom.getParent(ed.selection.getEnd(),function(n){return ed.dom.hasClass(n,nonEditClass);});if(sc||ec){t._setDisabled(1);return false;}else t._setDisabled(0);});},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};},_block:function(ed,e){var k=e.keyCode;if((k>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);}else{ed.onKeyDown.remove(t._block);ed.onKeyPress.remove(t._block);ed.onKeyUp.remove(t._block);ed.onPaste.remove(t._block);}t.disabled=s;}}});tinymce.PluginManager.add('noneditable',tinymce.plugins.NonEditablePlugin);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js new file mode 100755 index 0000000..77db577 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 743 2008-03-23 17:47:33Z spocke $ | ||
| 3 | * | ||
| 4 | * @author Moxiecode | ||
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | (function() { | ||
| 9 | var Event = tinymce.dom.Event; | ||
| 10 | |||
| 11 | tinymce.create('tinymce.plugins.NonEditablePlugin', { | ||
| 12 | init : function(ed, url) { | ||
| 13 | var t = this, editClass, nonEditClass; | ||
| 14 | |||
| 15 | t.editor = ed; | ||
| 16 | editClass = ed.getParam("noneditable_editable_class", "mceEditable"); | ||
| 17 | nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); | ||
| 18 | |||
| 19 | ed.onNodeChange.addToTop(function(ed, cm, n) { | ||
| 20 | var sc, ec; | ||
| 21 | |||
| 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); | ||
| 25 | }); | ||
| 26 | |||
| 27 | ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { | ||
| 28 | return ed.dom.hasClass(n, nonEditClass); | ||
| 29 | }); | ||
| 30 | |||
| 31 | // Block or unblock | ||
| 32 | if (sc || ec) { | ||
| 33 | t._setDisabled(1); | ||
| 34 | return false; | ||
| 35 | } else | ||
| 36 | t._setDisabled(0); | ||
| 37 | }); | ||
| 38 | }, | ||
| 39 | |||
| 40 | getInfo : function() { | ||
| 41 | return { | ||
| 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 | ||
| 47 | }; | ||
| 48 | }, | ||
| 49 | |||
| 50 | _block : function(ed, e) { | ||
| 51 | var k = e.keyCode; | ||
| 52 | |||
| 53 | // Don't block arrow keys, pg up/down, and F1-F12 | ||
| 54 | if ((k > 32 && k < 41) || (k > 111 && k < 124)) | ||
| 55 | return; | ||
| 56 | |||
| 57 | return Event.cancel(e); | ||
| 58 | }, | ||
| 59 | |||
| 60 | _setDisabled : function(s) { | ||
| 61 | var t = this, ed = t.editor; | ||
| 62 | |||
| 63 | tinymce.each(ed.controlManager.controls, function(c) { | ||
| 64 | c.setDisabled(s); | ||
| 65 | }); | ||
| 66 | |||
| 67 | if (s !== t.disabled) { | ||
| 68 | if (s) { | ||
| 69 | ed.onKeyDown.addToTop(t._block); | ||
| 70 | ed.onKeyPress.addToTop(t._block); | ||
| 71 | ed.onKeyUp.addToTop(t._block); | ||
| 72 | ed.onPaste.addToTop(t._block); | ||
| 73 | } else { | ||
| 74 | ed.onKeyDown.remove(t._block); | ||
| 75 | ed.onKeyPress.remove(t._block); | ||
| 76 | ed.onKeyUp.remove(t._block); | ||
| 77 | ed.onPaste.remove(t._block); | ||
| 78 | } | ||
| 79 | |||
| 80 | t.disabled = s; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | }); | ||
| 84 | |||
| 85 | // Register plugin | ||
| 86 | tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin); | ||
| 87 | })(); \ No newline at end of file | ||
