annotate static/js/tiny_mce/plugins/directionality/editor_plugin_src.js @ 327:a1bf6cf49720

Modified the implementation of the avatar tag to look for an attribute 'user_profile' on the user object. If present, this is assumed to be the profile. This improves the performance of the member list and some forum views.
author Brian Neal <bgneal@gmail.com>
date Tue, 22 Feb 2011 02:11:26 +0000
parents 88b2b9cb8c1f
children
rev   line source
bgneal@312 1 /**
bgneal@312 2 * editor_plugin_src.js
bgneal@312 3 *
bgneal@312 4 * Copyright 2009, Moxiecode Systems AB
bgneal@312 5 * Released under LGPL License.
bgneal@312 6 *
bgneal@312 7 * License: http://tinymce.moxiecode.com/license
bgneal@312 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@312 9 */
bgneal@312 10
bgneal@312 11 (function() {
bgneal@312 12 tinymce.create('tinymce.plugins.Directionality', {
bgneal@312 13 init : function(ed, url) {
bgneal@312 14 var t = this;
bgneal@312 15
bgneal@312 16 t.editor = ed;
bgneal@312 17
bgneal@312 18 ed.addCommand('mceDirectionLTR', function() {
bgneal@312 19 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
bgneal@312 20
bgneal@312 21 if (e) {
bgneal@312 22 if (ed.dom.getAttrib(e, "dir") != "ltr")
bgneal@312 23 ed.dom.setAttrib(e, "dir", "ltr");
bgneal@312 24 else
bgneal@312 25 ed.dom.setAttrib(e, "dir", "");
bgneal@312 26 }
bgneal@312 27
bgneal@312 28 ed.nodeChanged();
bgneal@312 29 });
bgneal@312 30
bgneal@312 31 ed.addCommand('mceDirectionRTL', function() {
bgneal@312 32 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
bgneal@312 33
bgneal@312 34 if (e) {
bgneal@312 35 if (ed.dom.getAttrib(e, "dir") != "rtl")
bgneal@312 36 ed.dom.setAttrib(e, "dir", "rtl");
bgneal@312 37 else
bgneal@312 38 ed.dom.setAttrib(e, "dir", "");
bgneal@312 39 }
bgneal@312 40
bgneal@312 41 ed.nodeChanged();
bgneal@312 42 });
bgneal@312 43
bgneal@312 44 ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
bgneal@312 45 ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
bgneal@312 46
bgneal@312 47 ed.onNodeChange.add(t._nodeChange, t);
bgneal@312 48 },
bgneal@312 49
bgneal@312 50 getInfo : function() {
bgneal@312 51 return {
bgneal@312 52 longname : 'Directionality',
bgneal@312 53 author : 'Moxiecode Systems AB',
bgneal@312 54 authorurl : 'http://tinymce.moxiecode.com',
bgneal@312 55 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
bgneal@312 56 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@312 57 };
bgneal@312 58 },
bgneal@312 59
bgneal@312 60 // Private methods
bgneal@312 61
bgneal@312 62 _nodeChange : function(ed, cm, n) {
bgneal@312 63 var dom = ed.dom, dir;
bgneal@312 64
bgneal@312 65 n = dom.getParent(n, dom.isBlock);
bgneal@312 66 if (!n) {
bgneal@312 67 cm.setDisabled('ltr', 1);
bgneal@312 68 cm.setDisabled('rtl', 1);
bgneal@312 69 return;
bgneal@312 70 }
bgneal@312 71
bgneal@312 72 dir = dom.getAttrib(n, 'dir');
bgneal@312 73 cm.setActive('ltr', dir == "ltr");
bgneal@312 74 cm.setDisabled('ltr', 0);
bgneal@312 75 cm.setActive('rtl', dir == "rtl");
bgneal@312 76 cm.setDisabled('rtl', 0);
bgneal@312 77 }
bgneal@312 78 });
bgneal@312 79
bgneal@312 80 // Register plugin
bgneal@312 81 tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
bgneal@312 82 })();