editor-lists-debug.js revision fa2ede9f0bd25baec5d0e29166b52862cfd11412
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Handles list manipulation inside the Editor. Adds keyboard manipulation and execCommand support. Adds overrides for the <a href="Plugin.ExecCommand.html#method_COMMANDS.insertorderedlist">insertorderedlist</a> and <a href="Plugin.ExecCommand.html#method_COMMANDS.insertunorderedlist">insertunorderedlist</a> execCommands.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @class Plugin.EditorLists
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @constructor
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @extends Base
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @module editor
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @submodule editor-lists
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng var EditorLists = function() {
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng EditorLists.superclass.constructor.apply(this, arguments);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng }, LI = 'li', OL = 'ol', UL = 'ul', HOST = 'host';
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Listener for host's nodeChange event and captures the tabkey interaction only when inside a list node.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @method _onNodeChange
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @param {Event} e The Event facade passed from the host.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng _onNodeChange: function(e) {
e03914f9208eb53e6c8a6d5a436953ad983642b0Robert Mustacchi var inst = this.get(HOST).getInstance(), sel, li,
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng newLi, newList, sTab, par, moved = false, tag, focusEnd = false;
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng Y.log('Overriding TAB to move lists around', 'info', 'editorLists');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng Y.log('ShiftKey: ' + sTab, 'info', 'editorLists');
da0006029e69465355313f503741ac6ebe0d513bGirish Moodalbail Y.log('Shifting list up one level', 'info', 'editorLists');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng //li.setStyle('border', '1px solid red');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng Y.log('Shifting list down one level', 'info', 'editorLists');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng newList = inst.Node.create('<' + tag + '></' + tag + '>');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng li = li.append(EditorLists.NON).one(EditorLists.NON_SEL);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng //Selection here..
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng Y.log('Selecting the new node', 'info', 'editorLists');
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng (new inst.Selection()).selectNode(li, true, focusEnd);
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The non element placeholder, used for positioning the cursor and filling empty items
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @property REMOVE
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The selector query to get all non elements
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @property NONSEL
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * The items to removed from a list when a list item is moved, currently removes BR nodes
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @property REMOVE
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * editorLists
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * @property NAME
0dc2366f7b9f9f36e10909b1e95edbf2a261c2acVenugopal Iyer * @property NS
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng}, '@VERSION@' ,{requires:['editor-base'], skinnable:false});