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");
6 dojo.require("dijit._editor._Plugin");
8 dojo.declare("dijit._editor.plugins.ToggleDir",
11 //summary: This plugin is used to toggle direction of the edited document only,
12 // no matter what direction the whole page is.
14 useDefaultCommand: false,
17 _initButton: function(){
18 this.inherited("_initButton", arguments);
19 this.connect(this.button, "onClick", this._toggleDir);
22 updateState: function(){},//overwrite
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";
32 dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){
33 if(o.plugin){ return; }
36 o.plugin = new dijit._editor.plugins.ToggleDir({command: o.args.name});