1 /** 2 * justifyLeft button. 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/justifyLeft/index", function (S, Editor, justifyCenterCmd) { 6 function exec() { 7 var editor = this.get("editor"); 8 editor.execCommand("justifyLeft"); 9 editor.focus(); 10 } 11 12 function justifyLeft() { 13 } 14 15 S.augment(justifyLeft, { 16 renderUI:function (editor) { 17 justifyCenterCmd.init(editor); 18 editor.addButton("justifyLeft", { 19 tooltip:"左对齐", 20 checkable:true, 21 listeners:{ 22 click:exec, 23 afterSyncUI:function () { 24 var self = this; 25 editor.on("selectionChange", function () { 26 if (editor.get("mode") == Editor.SOURCE_MODE) { 27 return; 28 } 29 if (editor.queryCommandValue("justifyLeft")) { 30 self.set("checked", true); 31 } else { 32 self.set("checked", false); 33 } 34 }); 35 } 36 }, 37 mode:Editor.WYSIWYG_MODE 38 }); 39 } 40 }); 41 42 return justifyLeft; 43 }, { 44 requires:['editor', './cmd'] 45 });