1 define("dijit/_editor/plugins/TabIndent", [
2 "dojo/_base/declare", // declare
3 "dojo/_base/kernel", // kernel.experimental
5 "../../form/ToggleButton"
6 ], function(declare, kernel, _Plugin, ToggleButton){
9 var _Plugin = dijit._editor._Plugin;
13 // dijit/_editor/plugins/TabIndent
15 // This plugin is used to allow the use of the tab and shift-tab keys
16 // to indent/outdent list items. This overrides the default behavior
17 // of moving focus from/to the toolbar
20 kernel.experimental("dijit._editor.plugins.TabIndent");
23 var TabIndent = declare("dijit._editor.plugins.TabIndent", _Plugin, {
25 // This plugin is used to allow the use of the tab and shift-tab keys
26 // to indent/outdent list items. This overrides the default behavior
27 // of moving focus from/to the toolbar
29 // Override _Plugin.useDefaultCommand... processing is handled by this plugin, not by dijit.Editor.
30 useDefaultCommand: false,
32 // Override _Plugin.buttonClass to use a ToggleButton for this plugin rather than a vanilla Button
33 buttonClass: ToggleButton,
37 _initButton: function(){
38 // Override _Plugin._initButton() to setup listener on button click
39 this.inherited(arguments);
42 this.connect(this.button, "onChange", function(val){
43 e.set("isTabIndent", val);
46 // Set initial checked state of button based on Editor.isTabIndent
50 updateState: function(){
51 // Overrides _Plugin.updateState().
52 // Ctrl-m in the editor will switch tabIndent mode on/off, so we need to react to that.
53 var disabled = this.get("disabled");
54 this.button.set("disabled", disabled);
58 this.button.set('checked', this.editor.isTabIndent, false);
62 // Register this plugin.
63 _Plugin.registry["tabIndent"] = function(){
64 return new TabIndent({command: "tabIndent"});