1 /** 2 * Add indent and outdent command identifier for KISSY Editor. 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/outdent/cmd", function (S, Editor, dentUtils) { 6 var addCommand = dentUtils.addCommand; 7 var checkOutdentActive = dentUtils.checkOutdentActive; 8 return { 9 init:function (editor) { 10 addCommand(editor, "outdent"); 11 var queryCmd = Editor.Utils.getQueryCmd("outdent"); 12 if (!editor.hasCommand(queryCmd)) { 13 editor.addCommand(queryCmd, { 14 exec:function (editor) { 15 var selection = editor.getSelection(); 16 if (selection && !selection.isInvalid) { 17 var startElement = selection.getStartElement(); 18 var elementPath = new Editor.ElementPath(startElement); 19 return checkOutdentActive(elementPath); 20 } 21 } 22 }); 23 } 24 } 25 }; 26 27 }, { 28 requires:['editor', '../dentUtils/cmd'] 29 });