Class: RangeSelection
lexical.RangeSelection
Implements
Constructors
constructor
• new RangeSelection(anchor
, focus
, format
, style
): RangeSelection
Parameters
Name | Type |
---|---|
anchor | PointType |
focus | PointType |
format | number |
style | string |
Returns
Defined in
packages/lexical/src/LexicalSelection.ts:406
Properties
_cachedNodes
• _cachedNodes: null
| LexicalNode
[]
Implementation of
Defined in
packages/lexical/src/LexicalSelection.ts:403
anchor
• anchor: PointType
Defined in
packages/lexical/src/LexicalSelection.ts:401
dirty
• dirty: boolean
Implementation of
Defined in
packages/lexical/src/LexicalSelection.ts:404
focus
• focus: PointType
Defined in
packages/lexical/src/LexicalSelection.ts:402
format
• format: number
Defined in
packages/lexical/src/LexicalSelection.ts:399
style
• style: string
Defined in
packages/lexical/src/LexicalSelection.ts:400
Methods
applyDOMRange
▸ applyDOMRange(range
): void
Attempts to map a DOM selection range onto this Lexical Selection, setting the anchor, focus, and type accordingly
Parameters
Name | Type | Description |
---|---|---|
range | StaticRange | a DOM Selection range conforming to the StaticRange interface. |
Returns
void
Defined in
packages/lexical/src/LexicalSelection.ts:609
clone
▸ clone(): RangeSelection
Creates a new RangeSelection, copying over all the property values from this one.
Returns
a new RangeSelection with the same property values as this one.
Implementation of
Defined in
packages/lexical/src/LexicalSelection.ts:645
deleteCharacter
▸ deleteCharacter(isBackward
): void
Performs one logical character deletion operation on the EditorState based on the current Selection. Handles different node types.
Parameters
Name | Type | Description |
---|---|---|
isBackward | boolean | whether or not the selection is backwards. |
Returns
void
Defined in
packages/lexical/src/LexicalSelection.ts:1741
deleteLine
▸ deleteLine(isBackward
): void
Performs one logical line deletion operation on the EditorState based on the current Selection. Handles different node types.
Parameters
Name | Type | Description |
---|---|---|
isBackward | boolean | whether or not the selection is backwards. |
Returns
void
Defined in
packages/lexical/src/LexicalSelection.ts:1847
deleteWord
▸ deleteWord(isBackward
): void
Performs one logical word deletion operation on the EditorState based on the current Selection. Handles different node types.
Parameters
Name | Type | Description |
---|---|---|
isBackward | boolean | whether or not the selection is backwards. |
Returns
void
Defined in
packages/lexical/src/LexicalSelection.ts:1882
extract
▸ extract(): LexicalNode
[]
Extracts the nodes in the Selection, splitting nodes where necessary to get offset-level precision.
Returns
The nodes in the Selection
Implementation of
Defined in
packages/lexical/src/LexicalSelection.ts:1502
formatText
▸ formatText(formatType
, alignWithFormat?
): void
Applies the provided format to the TextNodes in the Selection, splitting or merging nodes as necessary.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
formatType | TextFormatType | undefined | the format type to apply to the nodes in the Selection. |
alignWithFormat | null | number | null | a 32-bit integer representing formatting flags to align with. |
Returns
void
Defined in
packages/lexical/src/LexicalSelection.ts:1190
forwardDeletion
▸ forwardDeletion(anchor
, anchorNode
, isBackward
): boolean
Helper for handling forward character and word deletion that prevents element nodes like a table, columns layout being destroyed
Parameters
Name | Type | Description |
---|---|---|
anchor | PointType | the anchor |
anchorNode | ElementNode | TextNode | the anchor node in the selection |
isBackward | boolean | whether or not selection is backwards |
Returns
boolean
Defined in
packages/lexical/src/LexicalSelection.ts:1709
getCachedNodes
▸ getCachedNodes(): null
| LexicalNode
[]
Returns
null
| LexicalNode
[]