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