]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dijit/_editor/plugins/ToggleDir.js
Comment class stub
[eow] / static / dojo-release-1.1.1 / dijit / _editor / plugins / ToggleDir.js
1 if(!dojo._hasResource["dijit._editor.plugins.ToggleDir"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dijit._editor.plugins.ToggleDir"] = true;
3 dojo.provide("dijit._editor.plugins.ToggleDir");
4 dojo.experimental("dijit._editor.plugins.ToggleDir");
5
6 dojo.require("dijit._editor._Plugin");
7
8 dojo.declare("dijit._editor.plugins.ToggleDir",
9         dijit._editor._Plugin,
10         {
11                 //summary: This plugin is used to toggle direction of the edited document only,
12                 //                 no matter what direction the whole page is.
13                                 
14                 useDefaultCommand: false,
15                 command: "toggleDir",
16
17                 _initButton: function(){
18                         this.inherited("_initButton", arguments);
19                         this.connect(this.button, "onClick", this._toggleDir);          
20                 },
21
22                 updateState: function(){},//overwrite
23
24                 _toggleDir: function(){
25                         var editDoc = this.editor.editorObject.contentWindow.document.documentElement;
26                         var isLtr = dojo.getComputedStyle(editDoc).direction == "ltr";
27                         editDoc.dir/*html node*/ = isLtr ? "rtl" : "ltr";
28                 }
29         }
30 );
31
32 dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
33         if(o.plugin){ return; }
34         switch(o.args.name){
35         case "toggleDir":
36                 o.plugin = new dijit._editor.plugins.ToggleDir({command: o.args.name});
37         }
38 });
39
40 }