2 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
8 YUI.add('editor-tab', function(Y) {
11 * Handles tab and shift-tab indent/outdent support.
13 * @submodule editor-tab
16 * Handles tab and shift-tab indent/outdent support.
17 * @class Plugin.EditorTab
22 var EditorTab = function() {
23 EditorTab.superclass.constructor.apply(this, arguments);
26 Y.extend(EditorTab, Y.Base, {
28 * Listener for host's nodeChange event and captures the tabkey interaction.
30 * @method _onNodeChange
31 * @param {Event} e The Event facade passed from the host.
33 _onNodeChange: function(e) {
34 var action = 'indent';
36 if (e.changedType === 'tab') {
37 if (!e.changedNode.test('li, li *')) {
38 e.changedEvent.halt();
40 if (e.changedEvent.shiftKey) {
44 this.get(HOST).execCommand(action, '');
48 initializer: function() {
49 this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
72 Y.namespace('Plugin');
74 Y.Plugin.EditorTab = EditorTab;
77 }, '3.3.0' ,{requires:['editor-base'], skinnable:false});