[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/3.17.2/editor-tab/ -> editor-tab-debug.js (source)

   1  /*
   2  YUI 3.17.2 (build 9c3c78e)
   3  Copyright 2014 Yahoo! Inc. All rights reserved.
   4  Licensed under the BSD License.
   5  http://yuilibrary.com/license/
   6  */
   7  
   8  YUI.add('editor-tab', function (Y, NAME) {
   9  
  10  
  11      /**
  12       * Handles tab and shift-tab indent/outdent support.
  13       * @class Plugin.EditorTab
  14       * @constructor
  15       * @extends Base
  16       * @module editor
  17       * @submodule editor-tab
  18       */
  19  
  20      var EditorTab = function() {
  21          EditorTab.superclass.constructor.apply(this, arguments);
  22      }, HOST = 'host';
  23  
  24      Y.extend(EditorTab, Y.Base, {
  25          /**
  26          * Listener for host's nodeChange event and captures the tabkey interaction.
  27          * @private
  28          * @method _onNodeChange
  29          * @param {Event} e The Event facade passed from the host.
  30          */
  31          _onNodeChange: function(e) {
  32              var action = 'indent';
  33  
  34              if (e.changedType === 'tab') {
  35                  if (!e.changedNode.test('li, li *')) {
  36                      e.changedEvent.halt();
  37                      e.preventDefault();
  38                      if (e.changedEvent.shiftKey) {
  39                          action = 'outdent';
  40                      }
  41  
  42                      Y.log('Overriding TAB to ' + action, 'info', 'editorTab');
  43                      this.get(HOST).execCommand(action, '');
  44                  }
  45              }
  46          },
  47          initializer: function() {
  48              this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
  49          }
  50      }, {
  51          /**
  52          * editorTab
  53          * @property NAME
  54          * @static
  55          */
  56          NAME: 'editorTab',
  57          /**
  58          * tab
  59          * @property NS
  60          * @static
  61          */
  62          NS: 'tab',
  63          ATTRS: {
  64              host: {
  65                  value: false
  66              }
  67          }
  68      });
  69  
  70  
  71      Y.namespace('Plugin');
  72  
  73      Y.Plugin.EditorTab = EditorTab;
  74  
  75  
  76  }, '3.17.2', {"requires": ["editor-base"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1