EasyUI
文本编辑器
扩展组件 » TextEditor
创建 文本编辑器
从标记开始创建
使用javascript创建
属性
属性继承自dialog,新增属性如下.
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
| name | string | 表单字段名称 | |
| toolbar | array | 文本编辑器工具栏 | ['bold','italic','strikethrough','underline','-','justifyleft','justifycenter','justifyright','justifyfull','-','insertorderedlist','insertunorderedlist','outdent','indent','-','formatblock','fontname','fontsize'] |
| commands | object |
定义命令
代码实例:
$.extend($.fn.texteditor.defaults.commands, {
'bold': {
type: 'linkbutton',
iconCls: 'icon-bold',
onClick: function(){
$(this).texteditor('getEditor').texteditor('execCommand','bold');
}
}
});
|
事件
事件继承自dialog
方法
方法继承自dialog,如下是新增方法
| 名称 | 参数 | 描述 |
|---|---|---|
| options | none | 返回options属性 |
| execCommand | cmd | 执行一条命令 |
| getEditor | none | 获取编辑对象 |
| insertContent | html | 在当前光标位置插入HTML。 |
| destroy | none | 销毁编辑器 |
| getValue | none | 获取编辑器的值 |
| setValue | html | 设置编辑器的值。 |
| disable | none | 禁用文本编辑器组件。 |
| enable | none | 可使用文本编辑器组件。 |
| readonly | mode | 设置是否制度模式。 |
