Skip to content

@istock/editor / Exports / CommandEditorParser

Class: CommandEditorParser

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new CommandEditorParser(): CommandEditorParser

Returns

CommandEditorParser

Properties

blockTagNames

Static blockTagNames: string[]

Defined in

command-editor-parser.ts:13


brTagName

Static brTagName: string = 'BR'

Defined in

command-editor-parser.ts:14


lineBreak

Static lineBreak: string = '\n'

Defined in

command-editor-parser.ts:17


space

Static space: string = ' '

Defined in

command-editor-parser.ts:18


spaceRegMatch

Static spaceRegMatch: RegExp

Defined in

command-editor-parser.ts:16

Methods

#getBrTagHtml

#getBrTagHtml(node): string

获取br标签

Parameters

NameType
nodeTCommandEditorContentNode

Returns

string

Defined in

command-editor-parser.ts:25


#getLineTagHtml

#getLineTagHtml(node, value): string

获取一行数据

Parameters

NameType
nodeTCommandEditorContentNode
valuestring

Returns

string

Defined in

command-editor-parser.ts:45


#getTokenTagHtml

#getTokenTagHtml(node, value): string

获取token标签

Parameters

NameType
nodeTCommandEditorContentNode
valuestring

Returns

string

Defined in

command-editor-parser.ts:35


findCursorInfoForDom

findCursorInfoForDom(rootEl, offsetText): null | TCommandEditorRangInfo

根据DOM元素和光标位置之前的所有文本,获取光标的endContainer、endOffset信息

Parameters

NameType
rootElElement
offsetTextstring

Returns

null | TCommandEditorRangInfo

Defined in

command-editor-parser.ts:195


getOffsetTextForDom

getOffsetTextForDom(rootEl, offsetNode, offsetIndex?): string

获取指定节点指定位置前面所有字符串

Parameters

NameTypeDefault valueDescription
rootElElementundefined包含offsetNode的元素
offsetNodeNodeundefinedrange.endContainer
offsetIndexnumber-1range.endOffset,-1表示末尾

Returns

string

Defined in

command-editor-parser.ts:84


parseDomToText

parseDomToText(rootEl): string

解析元素成字符串

Parameters

NameType
rootElElement

Returns

string

Defined in

command-editor-parser.ts:53


parseVNodeToHtml

parseVNodeToHtml(vNodes): string

将vNode解析成html

Parameters

NameType
vNodesTCommandEditorContentNode[]

Returns

string

Defined in

command-editor-parser.ts:132


parseVNodeToText

parseVNodeToText(vNodes): string

将vNode解析成text

Parameters

NameType
vNodesTCommandEditorContentNode[]

Returns

string

Defined in

command-editor-parser.ts:173

免责声明:本站所有信息、数据、软件仅供学习研究,都不构成投资建议,本站不承担由此导致的任何责任。