1 /** 2 * Common btn for list. 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/listUtils/btn", function (S, Editor, Button) { 6 7 function onClick() { 8 var editor = this.get("editor"); 9 var cmd = this.get("cmdType"); 10 editor.execCommand(cmd); 11 editor.focus(); 12 } 13 14 return Button.extend({ 15 initializer:function () { 16 var self = this; 17 self.on("click", onClick, self); 18 var editor = self.get("editor"); 19 editor.on("selectionChange", function () { 20 var cmd = self.get("cmdType"); 21 if (editor.queryCommandValue(cmd)) { 22 self.set("checked", true); 23 } else { 24 self.set("checked", false); 25 } 26 }) 27 } 28 }, { 29 ATTRS:{ 30 checkable:{ 31 value:true 32 }, 33 mode:{ 34 value:Editor.WYSIWYG_MODE 35 } 36 } 37 }); 38 }, { 39 requires:['editor', '../button/'] 40 });