Content

new Content()

内容管理类

Extends

Members

(readonly) $editor

编辑器实例

(readonly) $path

对应路径

(readonly) contentLength

内容长度

(readonly) displayType

类型

Methods

_updatePoints(container, position, distance, newContainer)

range端点更新
Parameters:
NameTypeDescription
container*
position*
distance*
newContainer*

enterPath(path, range, direction) → {*}

光标进入
Parameters:
NameTypeDescription
path*
range*
direction*
Returns:
Type: 
*

isCaretShouldLeavePath(path, range, direction) → {Boolean}

检测光标是否要离开当前path
Parameters:
NameTypeDescription
pathPath路径
rangeRange选取范围
direction'left' | 'right'方向
Returns:
Type: 
Boolean

leavePath(path, range, direction) → {*}

光标离开
Parameters:
NameTypeDescription
path*
range*
direction*从哪个方向离开
Returns:
Type: 
*

onCaretMove(direction, range, event) → {*}

光标移动处理
Parameters:
NameTypeDescription
direction*
range*
event*
Returns:
Type: 
*

onKeydownArrowDown(range, event)

键盘下箭头处理
Parameters:
NameTypeDescription
range*
event*

onKeydownArrowLeft(range, event)

键盘左箭头处理
Parameters:
NameTypeDescription
range*
event*

onKeydownArrowRight(range, event)

键盘右箭头处理
Parameters:
NameTypeDescription
range*
event*

onKeydownArrowUp(range, event)

键盘上箭头处理
Parameters:
NameTypeDescription
range*
event*

onKeydownBackspace(range)

键盘空格处理
Parameters:
NameTypeDescription
range*

onKeydownEnter(range, event)

键盘回车处理
Parameters:
NameTypeDescription
range*
event*

setComponent(range, callback)

组件设置
Parameters:
NameTypeDescription
rangeRange
callbackfunction格式处理回调

setFormat(range, callback)

格式设置
Parameters:
NameTypeDescription
rangeRange
callbackfunction格式处理回调

update(path, range) → {*}

更新状态
Parameters:
NameTypeDescription
path*
range*
Returns:
Type: 
*

(static) onBeforeRender()

render前调用hook

(static) onInsert({) → {*}

内容插入处理
Parameters:
NameTypeDescription
{*data, type, range }
Returns:
Type: 
*

(static) onLinefeed(range, eventopt)

换行
Parameters:
NameTypeAttributesDefaultDescription
rangeRange
eventevent<optional>
null