Mercurial > public > sg101
comparison static/js/tiny_mce/plugins/directionality/editor_plugin_src.js @ 312:88b2b9cb8c1f
Fixing #142; cut over to the django.contrib.staticfiles app.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 27 Jan 2011 02:56:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
311:b1c39788e511 | 312:88b2b9cb8c1f |
---|---|
1 /** | |
2 * editor_plugin_src.js | |
3 * | |
4 * Copyright 2009, Moxiecode Systems AB | |
5 * Released under LGPL License. | |
6 * | |
7 * License: http://tinymce.moxiecode.com/license | |
8 * Contributing: http://tinymce.moxiecode.com/contributing | |
9 */ | |
10 | |
11 (function() { | |
12 tinymce.create('tinymce.plugins.Directionality', { | |
13 init : function(ed, url) { | |
14 var t = this; | |
15 | |
16 t.editor = ed; | |
17 | |
18 ed.addCommand('mceDirectionLTR', function() { | |
19 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | |
20 | |
21 if (e) { | |
22 if (ed.dom.getAttrib(e, "dir") != "ltr") | |
23 ed.dom.setAttrib(e, "dir", "ltr"); | |
24 else | |
25 ed.dom.setAttrib(e, "dir", ""); | |
26 } | |
27 | |
28 ed.nodeChanged(); | |
29 }); | |
30 | |
31 ed.addCommand('mceDirectionRTL', function() { | |
32 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); | |
33 | |
34 if (e) { | |
35 if (ed.dom.getAttrib(e, "dir") != "rtl") | |
36 ed.dom.setAttrib(e, "dir", "rtl"); | |
37 else | |
38 ed.dom.setAttrib(e, "dir", ""); | |
39 } | |
40 | |
41 ed.nodeChanged(); | |
42 }); | |
43 | |
44 ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); | |
45 ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); | |
46 | |
47 ed.onNodeChange.add(t._nodeChange, t); | |
48 }, | |
49 | |
50 getInfo : function() { | |
51 return { | |
52 longname : 'Directionality', | |
53 author : 'Moxiecode Systems AB', | |
54 authorurl : 'http://tinymce.moxiecode.com', | |
55 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', | |
56 version : tinymce.majorVersion + "." + tinymce.minorVersion | |
57 }; | |
58 }, | |
59 | |
60 // Private methods | |
61 | |
62 _nodeChange : function(ed, cm, n) { | |
63 var dom = ed.dom, dir; | |
64 | |
65 n = dom.getParent(n, dom.isBlock); | |
66 if (!n) { | |
67 cm.setDisabled('ltr', 1); | |
68 cm.setDisabled('rtl', 1); | |
69 return; | |
70 } | |
71 | |
72 dir = dom.getAttrib(n, 'dir'); | |
73 cm.setActive('ltr', dir == "ltr"); | |
74 cm.setDisabled('ltr', 0); | |
75 cm.setActive('rtl', dir == "rtl"); | |
76 cm.setDisabled('rtl', 0); | |
77 } | |
78 }); | |
79 | |
80 // Register plugin | |
81 tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); | |
82 })(); |