Editor编辑器模块
Editor富文本编辑器可编辑HTML,有别于textarea只能编辑text,支持多种快捷操作。
简单使用
对div
节点或textarea
节点使用ax-editor
属性即可创建富文本编辑器实例。
使用new+id
也是可以的。
-
-
-
new ax.Editor('#demo0001');
初始化内容
通过参数content
设置初始化内容,其写法同getContent
函数的content
参数;支持多种写法。
-
-
-
new ax.Editor('#demo0002',{
content:'初始文本内容'
});
基础配置
属性 |
类型 |
默认值 |
说明 |
name |
string |
'' |
隐藏字段的name属性 |
value |
string |
'' |
初始纯文本内容 |
disabled |
boolean |
false |
是否禁用编辑器 |
readonly |
boolean |
false |
是否只读模式 |
deferred |
boolean |
false |
是否延迟渲染子节点 |
delay |
number |
200 |
编辑事件防抖时间(ms) |
classes |
string |
'' |
编辑器额外样式类 |
数据源配置
属性 |
类型 |
默认值 |
说明 |
content |
string/array |
'' |
编辑器数据源 |
contType |
'text'/'async'/'html'/'auto' |
'text' |
内容类型 |
contData |
object |
{} |
请求数据参数 |
ajax |
object |
{} |
异步请求配置 |
外观配置
属性 |
类型 |
默认值 |
说明 |
appear.rounded |
boolean |
true |
是否显示圆角 |
appear.bordered |
boolean |
true |
是否显示边框 |
mode |
'source'/'editor' |
'editor' |
显示模式 |
minHeight |
string |
'' |
最小高度 |
maxHeight |
string |
'' |
最大高度 |
feature |
'simple'/'comm'/'flat'/'group'/'full' |
'simple' |
功能组合类型 |
工具栏配置
属性 |
类型 |
默认值 |
说明 |
header.enable |
boolean |
true |
是否启用头部按钮组 |
header.children |
array |
[] |
按钮布局配置 |
footer.enable |
boolean |
true |
是否启用底部信息栏 |
等待函数
属性 |
类型 |
默认值 |
说明 |
b4Paste |
function |
null |
粘贴前等待函数 |
回调函数
属性 |
类型 |
默认值 |
说明 |
onEdited |
function |
null |
编辑后回调 |
onDisabled |
function |
null |
禁用后回调 |
onEnabled |
function |
null |
启用后回调 |
onReadonly |
function |
null |
设置只读后回调 |
onFilled |
function |
null |
填充内容后回调 |
onSet |
function |
null |
设置值后回调 |
onCleared |
function |
null |
清除值后回调 |
onUpdatedCont |
function |
null |
更新内容后回调 |
onRequest |
function |
null |
异步请求完成回调 |
onOutput |
function |
null |
输出值后回调 |