1 /** 2 * Set up editor constructor 3 * @author yiminghe@gmail.com 4 */ 5 KISSY.add("editor/core/base", function (S, HtmlParser, Component) { 6 7 /** 8 * @class 9 * KISSY Editor. 10 * xclass: 'editor'. 11 * @extends Component.Controller 12 * @name Editor 13 */ 14 var Editor = Component.Controller.extend( 15 /** 16 * @lends Editor# 17 */ 18 { 19 initializer:function () { 20 var self = this; 21 self.__commands = {}; 22 self.__controls = {}; 23 } 24 }, 25 26 { 27 Config:{}, 28 XHTML_DTD:HtmlParser['DTD'], 29 ATTRS:/** 30 * @lends Editor# 31 */ 32 { 33 /** 34 * textarea 35 * @type Node 36 */ 37 textarea:{}, 38 /** 39 * iframe 40 * @type Node 41 */ 42 iframe:{}, 43 /** 44 * iframe 's contentWindow 45 * @type Node 46 */ 47 window:{}, 48 /** 49 * iframe 's document 50 * @type Node 51 */ 52 document:{}, 53 /** 54 * toolbar element 55 * @type Node 56 */ 57 toolBarEl:{}, 58 /** 59 * status bar element 60 * @type Node 61 */ 62 statusBarEl:{}, 63 handleMouseEvents:{ 64 value:false 65 }, 66 focusable:{ 67 value:false 68 }, 69 /** 70 * editor mode. 71 * wysiswyg mode:1 72 * source mode:0 73 * @default wysiswyg mode 74 */ 75 mode:{ 76 value:1 77 }, 78 /** 79 * Current editor's content 80 * @type String 81 */ 82 data:{ 83 getter:function () { 84 return this._getData(); 85 }, 86 setter:function (v) { 87 return this._setData(v); 88 } 89 }, 90 /** 91 * Current editor's format content 92 * @type String 93 */ 94 formatData:{ 95 getter:function () { 96 return this._getData(1); 97 }, 98 setter:function (v) { 99 return this._setData(v); 100 } 101 }, 102 103 /** 104 * Custom style for editor. 105 * @type String 106 */ 107 customStyle:{ 108 value:"" 109 }, 110 111 /** 112 * Custom css link url for editor. 113 * @type String[] 114 */ 115 customLink:{ 116 value:[] 117 } 118 } 119 }, { 120 xclass:'editor' 121 }); 122 123 124 Editor.HTML_PARSER = { 125 126 textarea:function (el) { 127 return el.one(".ks-editor-textarea"); 128 } 129 130 }; 131 132 S.mix(Editor, S.EventTarget); 133 134 KISSY.Editor = Editor; 135 136 return Editor; 137 }, { 138 requires:['htmlparser', 'component', 'core'] 139 });