Expand all

ve.ce.TextState

Constructor

new ve.ce.TextState(element) #

Annotated text content state (a snapshot of node content)

Parameters:

Name Type Description
element HTMLElement

Element whose content is to be snapshotted

Source:
Annotated text content state (a snapshot of node content)

Properties

chunks #

Properties:

Name Type Description
chunks Array.<ve.ce.TextStateChunk> | null

Linearized annotated text content

Source:

Methods

getChangeTransaction(prev, modelDoc, modelOffset, [unicornAnnotations]) → {ve.dm.Transaction|null} #

Create a model transaction from a change in text state. This must be fast enough to cope with the typical typing scenario (either with or without an IME) where the contents of a single text node get modified several times per second.

Parameters:

Name Type Attributes Description
prev ve.ce.TextState

Previous text state (must be for the same node)

modelDoc ve.dm.Document

The model document

modelOffset number

The offset of the node in the model

unicornAnnotations ve.dm.AnnotationSet optional

The annotations at the unicorn, if any

Source:

Returns:

Transaction corresponding to the text state change

Type
ve.dm.Transaction | null
Create a model transaction from a change in text state.

isEqual(other) → {boolean} #

Test whether the text state is equal to another.

Parameters:

Name Type Description
other ve.ce.TextState

The other text state

Source:

Returns:

Whether the states are equal

Type
boolean
Test whether the text state is equal to another.

getChunks(element) → {Array.<ve.ce.TextStateChunk>}static #

Saves a snapshot of the current text content state

Parameters:

Name Type Description
element HTMLElement

Element whose content is to be snapshotted

Source:

Returns:

chunks

Type
Array.<ve.ce.TextStateChunk>
Saves a snapshot of the current text content state