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/directionality | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/directionality')
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js | 79 |
2 files changed, 80 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js b/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js new file mode 100755 index 0000000..6966d80 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js new file mode 100755 index 0000000..81818e3 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ | ||
| 3 | * | ||
| 4 | * @author Moxiecode | ||
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | (function() { | ||
| 9 | tinymce.create('tinymce.plugins.Directionality', { | ||
| 10 | init : function(ed, url) { | ||
| 11 | var t = this; | ||
| 12 | |||
| 13 | t.editor = ed; | ||
| 14 | |||
| 15 | ed.addCommand('mceDirectionLTR', function() { | ||
| 16 | var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | ||
| 17 | |||
| 18 | if (e) { | ||
| 19 | if (ed.dom.getAttrib(e, "dir") != "ltr") | ||
| 20 | ed.dom.setAttrib(e, "dir", "ltr"); | ||
| 21 | else | ||
| 22 | ed.dom.setAttrib(e, "dir", ""); | ||
| 23 | } | ||
| 24 | |||
| 25 | ed.nodeChanged(); | ||
| 26 | }); | ||
| 27 | |||
| 28 | ed.addCommand('mceDirectionRTL', function() { | ||
| 29 | var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | ||
| 30 | |||
| 31 | if (e) { | ||
| 32 | if (ed.dom.getAttrib(e, "dir") != "rtl") | ||
| 33 | ed.dom.setAttrib(e, "dir", "rtl"); | ||
| 34 | else | ||
| 35 | ed.dom.setAttrib(e, "dir", ""); | ||
| 36 | } | ||
| 37 | |||
| 38 | ed.nodeChanged(); | ||
| 39 | }); | ||
| 40 | |||
| 41 | ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); | ||
| 42 | ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); | ||
| 43 | |||
| 44 | ed.onNodeChange.add(t._nodeChange, t); | ||
| 45 | }, | ||
| 46 | |||
| 47 | getInfo : function() { | ||
| 48 | return { | ||
| 49 | longname : 'Directionality', | ||
| 50 | author : 'Moxiecode Systems AB', | ||
| 51 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 52 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', | ||
| 53 | version : tinymce.majorVersion + "." + tinymce.minorVersion | ||
| 54 | }; | ||
| 55 | }, | ||
| 56 | |||
| 57 | // Private methods | ||
| 58 | |||
| 59 | _nodeChange : function(ed, cm, n) { | ||
| 60 | var dom = ed.dom, dir; | ||
| 61 | |||
| 62 | n = dom.getParent(n, dom.isBlock); | ||
| 63 | if (!n) { | ||
| 64 | cm.setDisabled('ltr', 1); | ||
| 65 | cm.setDisabled('rtl', 1); | ||
| 66 | return; | ||
| 67 | } | ||
| 68 | |||
| 69 | dir = dom.getAttrib(n, 'dir'); | ||
| 70 | cm.setActive('ltr', dir == "ltr"); | ||
| 71 | cm.setDisabled('ltr', 0); | ||
| 72 | cm.setActive('rtl', dir == "rtl"); | ||
| 73 | cm.setDisabled('rtl', 0); | ||
| 74 | } | ||
| 75 | }); | ||
| 76 | |||
| 77 | // Register plugin | ||
| 78 | tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); | ||
| 79 | })(); \ No newline at end of file | ||
