1 /** 2 * font formatting for kissy editor 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/plugin/fontSize/index", function (S, Editor, ui, cmd) { 6 7 function FontSizePlugin(config) { 8 this.config = config || {}; 9 } 10 11 S.augment(FontSizePlugin, { 12 renderUI:function (editor) { 13 14 cmd.init(editor); 15 16 function wrapFont(vs) { 17 var v = []; 18 S.each(vs, function (n) { 19 v.push({ 20 content:n, 21 value:n 22 }); 23 }); 24 return v; 25 } 26 27 var fontSizeConfig = this.config; 28 29 fontSizeConfig.menu = S.mix({ 30 children:wrapFont([ 31 "8px", "10px", "12px", 32 "14px", "18px", "24px", 33 "36px", "48px", "60px", 34 "72px", "84px", "96px" 35 ]) 36 }, fontSizeConfig.menu); 37 38 editor.addSelect("fontSize", S.mix({ 39 cmdType:"fontSize", 40 defaultCaption:"大小", 41 width:"70px", 42 mode:Editor.WYSIWYG_MODE 43 }, fontSizeConfig), ui.Select); 44 } 45 }); 46 47 return FontSizePlugin; 48 }, { 49 requires:['editor', '../font/ui', './cmd'] 50 }); 51