Interface: NodeCaretRange<D>
lexical.NodeCaretRange
A RangeSelection expressed as a pair of Carets
Type parameters
Name | Type |
---|---|
D | extends CaretDirection = CaretDirection |
Hierarchy
-
Iterable
<RangeNodeCaret
<D
>>↳
NodeCaretRange
Properties
anchor
• anchor: RangeNodeCaret
<D
>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:92
direction
• Readonly
direction: D
Defined in
packages/lexical/src/caret/LexicalCaret.ts:91
focus
• focus: RangeNodeCaret
<D
>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:93
getNonEmptyTextSlices
• getNonEmptyTextSlices: () => TextNodeCaretSliceTuple
<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 TextNodeCarets 1: One of anchor or focus are non-empty TextNodeCaret, or of the same origin 2: Anchor and focus are both non-empty TextNodeCaret of different origin
Type declaration
▸ (): TextNodeCaretSliceTuple
<D
>
Returns
Defined in
packages/lexical/src/caret/LexicalCaret.ts:109
getTextSlices
• getTextSlices: () => TextNodeCaretSliceTuple
<D
>
There are between zero and two TextSliceCarets for a NodeCaretRange
0: Neither anchor nor focus are TextNodeCarets 1: One of anchor or focus are TextNodeCaret, or of the same origin 2: Anchor and focus are both TextNodeCaret of different origin
Type declaration
▸ (): TextNodeCaretSliceTuple
<D
>
Returns
Defined in
packages/lexical/src/caret/LexicalCaret.ts:117
internalCarets
• internalCarets: (rootMode
: RootMode
) => IterableIterator
<NodeCaret
<D
>>
Iterate the carets between anchor and focus in a pre-order fashion
Type declaration
▸ (rootMode
): IterableIterator
<NodeCaret
<D
>>
Parameters
Name | Type |
---|---|
rootMode | RootMode |
Returns
IterableIterator
<NodeCaret
<D
>>
Defined in
packages/lexical/src/caret/LexicalCaret.ts:99
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:95
type
• Readonly
type: "node-caret-range"
Defined in
packages/lexical/src/caret/LexicalCaret.ts:90
Methods
[iterator]
▸ [iterator](): Iterator
<RangeNodeCaret
<D
>, any
, undefined
>
Returns
Iterator
<RangeNodeCaret
<D
>, any
, undefined
>
Inherited from
Iterable.[iterator]