[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/3.17.2/editor-tab/ -> editor-tab.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                      this.get(HOST).execCommand(action, '');
  43                  }
  44              }
  45          },
  46          initializer: function() {
  47              this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
  48          }
  49      }, {
  50          /**
  51          * editorTab
  52          * @property NAME
  53          * @static
  54          */
  55          NAME: 'editorTab',
  56          /**
  57          * tab
  58          * @property NS
  59          * @static
  60          */
  61          NS: 'tab',
  62          ATTRS: {
  63              host: {
  64                  value: false
  65              }
  66          }
  67      });
  68  
  69  
  70      Y.namespace('Plugin');
  71  
  72      Y.Plugin.EditorTab = EditorTab;
  73  
  74  
  75  }, '3.17.2', {"requires": ["editor-base"]});


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