]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dijit / _editor / plugins / TabIndent.js.uncompressed.js
1 define("dijit/_editor/plugins/TabIndent", [
2         "dojo/_base/declare", // declare
3         "dojo/_base/kernel", // kernel.experimental
4         "../_Plugin",
5         "../../form/ToggleButton"
6 ], function(declare, kernel, _Plugin, ToggleButton){
7
8         // module:
9         //              dijit/_editor/plugins/TabIndent
10
11         kernel.experimental("dijit._editor.plugins.TabIndent");
12
13
14         var TabIndent = declare("dijit._editor.plugins.TabIndent", _Plugin, {
15                 // summary:
16                 //              This plugin is used to allow the use of the tab and shift-tab keys
17                 //              to indent/outdent list items.  This overrides the default behavior
18                 //              of moving focus from/to the toolbar
19
20                 // Override _Plugin.useDefaultCommand... processing is handled by this plugin, not by dijit/Editor.
21                 useDefaultCommand: false,
22
23                 // Override _Plugin.buttonClass to use a ToggleButton for this plugin rather than a vanilla Button
24                 buttonClass: ToggleButton,
25
26                 command: "tabIndent",
27
28                 _initButton: function(){
29                         // Override _Plugin._initButton() to setup listener on button click
30                         this.inherited(arguments);
31
32                         var e = this.editor;
33                         this.connect(this.button, "onChange", function(val){
34                                 e.set("isTabIndent", val);
35                         });
36
37                         // Set initial checked state of button based on Editor.isTabIndent
38                         this.updateState();
39                 },
40
41                 updateState: function(){
42                         // Overrides _Plugin.updateState().
43                         // Ctrl-m in the editor will switch tabIndent mode on/off, so we need to react to that.
44                         var disabled = this.get("disabled");
45                         this.button.set("disabled", disabled);
46                         if(disabled){
47                                 return;
48                         }
49                         this.button.set('checked', this.editor.isTabIndent, false);
50                 }
51         });
52
53         // Register this plugin.
54         _Plugin.registry["tabIndent"] = function(){
55                 return new TabIndent({command: "tabIndent"});
56         };
57
58
59         return TabIndent;
60 });