editor-lists.js revision d2a5a45ff58ab15a8ee0339edcd03f0243373d59
b39897a381c2203466da5568bfd2862a54a81311Adam Moore * 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.
4778ff543a041ac356d6e661cc9b66c3fafa2092Adam Moore * @module editor
2c5ce90c334a2d0f18474e85c93b424b6ec9daaaAdam Moore * @submodule editor-lists
1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749Adam Moore * 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.
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @class Plugin.EditorLists
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @constructor
87d6b0a14cce52c4faa4b78fc9878eb553dab0d5Adam Moore * @extends Base
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove var EditorLists = function() {
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove EditorLists.superclass.constructor.apply(this, arguments);
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove }, LI = 'li', OL = 'ol', UL = 'ul', HOST = 'host';
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * Listener for host's nodeChange event and captures the tabkey interaction only when inside a list node.
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @method _onNodeChange
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @param {Event} e The Event facade passed from the host.
1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749Adam Moore _onNodeChange: function(e) {
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove var inst = this.get(HOST).getInstance(), sel, li,
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove newLi, newList, sTab, par, moved = false, tag, focusEnd = false;
1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749Adam Moore newLi = inst.Node.create('<' + LI + '>' + EditorLists.NON + '</' + LI + '>');
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove sel.selectNode(newLi.get('firstChild'), true, false);
67e8ed2937abc262dbe7537695d632143294269fRyan Grove //li.setStyle('border', '1px solid red');
67e8ed2937abc262dbe7537695d632143294269fRyan Grove newList = inst.Node.create('<' + tag + '></' + tag + '>');
67e8ed2937abc262dbe7537695d632143294269fRyan Grove li = li.append(EditorLists.NON).one(EditorLists.NON_SEL);
67e8ed2937abc262dbe7537695d632143294269fRyan Grove //Selection here..
67e8ed2937abc262dbe7537695d632143294269fRyan Grove (new inst.Selection()).selectNode(li, true, focusEnd);
6ed148777f04d35c42c9370c8108484f14be78a2Ryan Grove this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
6ed148777f04d35c42c9370c8108484f14be78a2Ryan Grove * The non element placeholder, used for positioning the cursor and filling empty items
6ed148777f04d35c42c9370c8108484f14be78a2Ryan Grove * @property REMOVE
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * The selector query to get all non elements
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @property NONSEL
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * The items to removed from a list when a list item is moved, currently removes BR nodes
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @property REMOVE
16bec62f211cecacdbbc2cb4632f079ef8c7f936Adam Moore * editorLists
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @property NAME
58ce26ddee9c5cc583f031eeb1ed36aea797bdcaRyan Grove * @property NS
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * Override for the insertunorderedlist method from the <a href="Plugin.EditorLists.html">EditorLists</a> plugin.
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * @for ExecCommand
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * @method COMMANDS.insertunorderedlist
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * @param {String} cmd The command executed: insertunorderedlist
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * @return {Node} Node instance of the item touched by this command.
c97ced1ebe127b04e46886f1b43dc0b00672e34bRyan Grove * Override for the insertorderedlist method from the <a href="Plugin.EditorLists.html">EditorLists</a> plugin.
67e8ed2937abc262dbe7537695d632143294269fRyan Grove * @for ExecCommand
67e8ed2937abc262dbe7537695d632143294269fRyan Grove * @method COMMANDS.insertorderedlist
6ed148777f04d35c42c9370c8108484f14be78a2Ryan Grove * @param {String} cmd The command executed: insertorderedlist
6ed148777f04d35c42c9370c8108484f14be78a2Ryan Grove * @return {Node} Node instance of the item touched by this command.
67e8ed2937abc262dbe7537695d632143294269fRyan Grove}, '@VERSION@' ,{skinnable:false, requires:['editor-base']});