Editor编辑器模块

Editor富文本编辑器可编辑HTML,有别于textarea只能编辑text,支持多种快捷操作。

简单使用

div节点或textarea节点使用ax-editor属性即可创建富文本编辑器实例。

  • 输出
  • HTML
  •                 
                    
                

使用new+id也是可以的。

  • 输出
  • HTML
  • JS
  •                 
                    
                
  •                 
                    new ax.Editor('#demo0001');
                    
                

初始化内容

通过参数content设置初始化内容,其写法同getContent函数的content参数;支持多种写法。

  • 输出
  • HTML
  • JS
  •                 
                    
                
  •                 
                    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 输出值后回调