Expand all

ve.ce.RangeState

Constructor

new ve.ce.RangeState(old, root, selectionOnly) #

ContentEditable range state (a snapshot of CE selection/content state)

Parameters:

Name Type Description
old ve.ce.RangeState | null

Previous range state

root ve.ce.BranchNode

Surface root

selectionOnly boolean

The caller promises the content has not changed from old

Source:
ContentEditable range state (a snapshot of CE selection/content state)

Properties

branchNodeChanged #

Properties:

Name Type Description
branchNodeChanged boolean

Whether the CE branch node changed

Source:

contentChanged #

Properties:

Name Type Description
contentChanged boolean

Whether the content changed

This is only set to true if both the old and new states have the same current branch node, whose content has changed

Source:

focusIsAfterAnnotationBoundary #

Properties:

Name Type Description
focusIsAfterAnnotationBoundary boolean | null

Focus lies after annotation tag

Source:

hash #

Properties:

Name Type Description
DOM string | null

Hash of current branch node

Source:

misleadingSelection #

Saved selection for future comparisons. (But it is not properly frozen, because the nodes are live and mutable, and therefore the offsets may come to point to places that are misleadingly different from when the selection was saved).

Properties:

Name Type Description
misleadingSelection ve.SelectionState

Saved selection (but with live nodes)

Source:
Saved selection for future comparisons.

node #

Properties:

Name Type Description
node ve.ce.BranchNode | null

The current branch node

Source:

selectionChanged #

Properties:

Name Type Description
selectionChanged boolean

Whether the DOM range changed

Source:

text #

Properties:

Name Type Description
text string | null

Plain text of current branch node

Source:

textState #

Properties:

Name Type Description
Current ve.ce.TextState | null

branch node's annotated content

Source:

veRange #

Properties:

Name Type Description
veRange ve.Range | null

The current selection range

Source:

Methods

saveState(old, root, selectionOnly) #

Saves a snapshot of the current range state

Parameters:

Name Type Description
old ve.ce.RangeState | null

Previous range state

root ve.ce.BranchNode

Surface root

selectionOnly boolean

The caller promises the content has not changed from old

Source:
Saves a snapshot of the current range state