diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js')
-rw-r--r-- | lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js b/lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js new file mode 100644 index 000000000..3cd0a136b --- /dev/null +++ b/lib/dijit/_editor/plugins/TabIndent.js.uncompressed.js @@ -0,0 +1,60 @@ +define("dijit/_editor/plugins/TabIndent", [ + "dojo/_base/declare", // declare + "dojo/_base/kernel", // kernel.experimental + "../_Plugin", + "../../form/ToggleButton" +], function(declare, kernel, _Plugin, ToggleButton){ + + // module: + // dijit/_editor/plugins/TabIndent + + kernel.experimental("dijit._editor.plugins.TabIndent"); + + + var TabIndent = declare("dijit._editor.plugins.TabIndent", _Plugin, { + // summary: + // This plugin is used to allow the use of the tab and shift-tab keys + // to indent/outdent list items. This overrides the default behavior + // of moving focus from/to the toolbar + + // Override _Plugin.useDefaultCommand... processing is handled by this plugin, not by dijit/Editor. + useDefaultCommand: false, + + // Override _Plugin.buttonClass to use a ToggleButton for this plugin rather than a vanilla Button + buttonClass: ToggleButton, + + command: "tabIndent", + + _initButton: function(){ + // Override _Plugin._initButton() to setup listener on button click + this.inherited(arguments); + + var e = this.editor; + this.connect(this.button, "onChange", function(val){ + e.set("isTabIndent", val); + }); + + // Set initial checked state of button based on Editor.isTabIndent + this.updateState(); + }, + + updateState: function(){ + // Overrides _Plugin.updateState(). + // Ctrl-m in the editor will switch tabIndent mode on/off, so we need to react to that. + var disabled = this.get("disabled"); + this.button.set("disabled", disabled); + if(disabled){ + return; + } + this.button.set('checked', this.editor.isTabIndent, false); + } + }); + + // Register this plugin. + _Plugin.registry["tabIndent"] = function(){ + return new TabIndent({command: "tabIndent"}); + }; + + + return TabIndent; +}); |