Interface: NodeCaretRange<D>
lexical.NodeCaretRange
A RangeSelection expressed as a pair of Carets
Type parameters
Name | Type |
---|---|
D | extends CaretDirection = CaretDirection |
Hierarchy
-
Iterable
<PointNodeCaret
<D
>>↳
NodeCaretRange
Properties
anchor
• anchor: PointNodeCaret
<D
>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:114
direction
• Readonly
direction: D
Defined in
packages/lexical/src/caret/LexicalCaret.ts:113
focus
• focus: PointNodeCaret
<D
>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:115
getNonEmptyTextSlices
• getNonEmptyTextSlices: () => TextPointCaretSliceTuple
<D
>
There are between zero and two non-empty TextSliceCarets for a NodeCaretRange. Non-empty is defined by indexEnd > indexStart (some text will be in the slice).
0: Neither anchor nor focus are non-empty TextPointCarets 1: One of anchor or focus are non-empty TextPointCaret, or of the same origin 2: Anchor and focus are both non-empty TextPointCaret of different origin
Type declaration
▸ (): TextPointCaretSliceTuple
<D
>
Returns
Defined in
packages/lexical/src/caret/LexicalCaret.ts:133
getTextSlices
• getTextSlices: () => TextPointCaretSliceTuple
<D
>
There are between zero and two TextSliceCarets for a NodeCaretRange
0: Neither anchor nor focus are TextPointCarets 1: One of anchor or focus are TextPointCaret, or of the same origin 2: Anchor and focus are both TextPointCaret of different origin
Type declaration
▸ (): TextPointCaretSliceTuple
<D
>
Returns
Defined in
packages/lexical/src/caret/LexicalCaret.ts:141
isCollapsed
• isCollapsed: () => boolean
Return true if anchor and focus are the same caret
Type declaration
▸ (): boolean
Returns
boolean
Defined in
packages/lexical/src/caret/LexicalCaret.ts:117
iterNodeCarets
• iterNodeCarets: (rootMode
: RootMode
) => IterableIterator
<NodeCaret
<D
>>
Iterate the carets between anchor and focus in a pre-order fashion, node that this does not include any text slices represented by the anchor and/or focus. Those are accessed separately from getTextSlices.
Type declaration
▸ (rootMode
): IterableIterator
<NodeCaret
<D
>>
Parameters
Name | Type |
---|---|
rootMode | RootMode |
Returns
IterableIterator
<NodeCaret
<D
>>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:123
type
• Readonly
type: "node-caret-range"
Defined in
packages/lexical/src/caret/LexicalCaret.ts:112
Methods
[iterator]
▸ [iterator](): Iterator
<PointNodeCaret
<D
>, any
, undefined
>
Returns
Iterator
<PointNodeCaret
<D
>, any
, undefined
>
Inherited from
Iterable.[iterator]