1 /** 2 * ol command 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/unorderedList/cmd", function (S, Editor, listCmd) { 6 7 var insertUnorderedList = "insertUnorderedList", 8 ListCommand = listCmd.ListCommand, 9 queryActive = listCmd.queryActive, 10 ulCmd = new ListCommand("ul"); 11 12 return { 13 init:function (editor) { 14 if (!editor.hasCommand(insertUnorderedList)) { 15 editor.addCommand(insertUnorderedList, { 16 exec:function (editor) { 17 editor.focus(); 18 ulCmd.exec(editor); 19 } 20 }); 21 } 22 23 var queryUl = Editor.Utils.getQueryCmd(insertUnorderedList); 24 25 if (!editor.hasCommand(queryUl)) { 26 editor.addCommand(queryUl, { 27 exec:function (editor) { 28 var selection = editor.getSelection(); 29 if (selection && !selection.isInvalid) { 30 var startElement = selection.getStartElement(); 31 var elementPath = new Editor.ElementPath(startElement); 32 return queryActive("ul", elementPath); 33 } 34 } 35 }); 36 } 37 } 38 }; 39 40 }, { 41 requires:['editor', '../listUtils/cmd'] 42 });