1 /** 2 * Maximize plugin 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/maximize/index", function (S, Editor, maximizeCmd) { 6 var MAXIMIZE_CLASS = "maximize", 7 RESTORE_CLASS = "restore", 8 MAXIMIZE_TIP = "全屏", 9 RESTORE_TIP = "取消全屏"; 10 11 12 function maximizePlugin() { 13 14 } 15 16 S.augment(maximizePlugin, { 17 renderUI:function (editor) { 18 maximizeCmd.init(editor); 19 editor.addButton("maximize", { 20 tooltip:MAXIMIZE_TIP, 21 listeners:{ 22 click:function () { 23 var self = this; 24 var checked = self.get("checked"); 25 if (checked) { 26 editor.execCommand("maximizeWindow"); 27 self.set("tooltip", RESTORE_TIP); 28 self.set("contentCls", RESTORE_CLASS); 29 } else { 30 editor.execCommand("restoreWindow"); 31 self.set("tooltip", MAXIMIZE_TIP); 32 self.set("contentCls", MAXIMIZE_CLASS); 33 } 34 35 editor.focus(); 36 } 37 38 }, 39 checkable:true 40 }); 41 } 42 }); 43 44 return maximizePlugin; 45 }, { 46 requires:['editor', './cmd'] 47 });