BlockSuite API Documentation / @blocksuite/lit / RangeManager
Class: RangeManager ​
CRUD for Range and TextSelection
Contents ​
Constructors ​
new RangeManager(root) ​
new RangeManager(
root
):RangeManager
Parameters ​
• root: BlockSuiteRoot
Returns ​
Source ​
packages/lit/src/utils/range-manager.ts:28
Properties ​
_isRangeReversed ​
private
_isRangeReversed:boolean
=false
Source ​
packages/lit/src/utils/range-manager.ts:35
_range ​
private
_range:null
|Range
=null
Source ​
packages/lit/src/utils/range-manager.ts:34
rangeSynchronizer ​
readonly
rangeSynchronizer:RangeSynchronizer
Source ​
packages/lit/src/utils/range-manager.ts:26
root ​
root:
BlockSuiteRoot
Source ​
packages/lit/src/utils/range-manager.ts:28
Accessors ​
value ​
get
value():null
|Range
Returns ​
null
| Range
Source ​
packages/lit/src/utils/range-manager.ts:30
Methods ​
_calculateVirgo() ​
private
_calculateVirgo(point
):null
| [VEditor
<Object
>,VRange
]
Parameters ​
• point: TextRangePoint
Returns ​
null
| [VEditor
<Object
>, VRange
]
Source ​
packages/lit/src/utils/range-manager.ts:212
_getBlock() ​
private
_getBlock(element
):BlockElement
<BaseBlockModel
<object
>,BlockService
<BaseBlockModel
<object
>>,string
>
Parameters ​
• element: HTMLElement
Returns ​
BlockElement
<BaseBlockModel
<object
>, BlockService
<BaseBlockModel
<object
>>, string
>
Source ​
packages/lit/src/utils/range-manager.ts:356
_getNearestVirgo() ​
private
_getNearestVirgo(node
):undefined
|VirgoRootElement
Parameters ​
• node: Node
Returns ​
undefined
| VirgoRootElement
Source ​
packages/lit/src/utils/range-manager.ts:342
_mergeRanges() ​
private
_mergeRanges(ranges
):null
|Object
Parameters ​
• ranges: RangeSnapshot
[]
Returns ​
null
| Object
Source ​
packages/lit/src/utils/range-manager.ts:270
_nodeToPoint() ​
private
_nodeToPoint(node
):null
|Object
Parameters ​
• node: Node
Returns ​
null
| Object
Source ​
packages/lit/src/utils/range-manager.ts:239
_renderRange() ​
private
_renderRange():void
Returns ​
void
Source ​
packages/lit/src/utils/range-manager.ts:323
_snapshotToRange() ​
private
_snapshotToRange(snapshot
):Range
Parameters ​
• snapshot: RangeSnapshot
Returns ​
Range
Source ​
packages/lit/src/utils/range-manager.ts:263
clearRange() ​
clearRange(
sync
):void
Parameters ​
• sync: boolean
= true
Returns ​
void
Source ​
packages/lit/src/utils/range-manager.ts:37
getSelectedBlockElementsByRange() ​
getSelectedBlockElementsByRange(
range
,options
):BlockElement
<BaseBlockModel
<object
>,BlockService
<BaseBlockModel
<object
>>,string
>[]
Parameters ​
• range: Range
• options: Object
= {}
• options.match?: (el
) => boolean
• options.mode?: "all"
| "flat"
| "highest"
Returns ​
BlockElement
<BaseBlockModel
<object
>, BlockService
<BaseBlockModel
<object
>>, string
>[]
Example ​
aaa
b[bb
ccc
ddd
ee]e
all mode: [aaa, bbb, ccc, ddd, eee]
flat mode: [bbb, ccc, ddd, eee]
highest mode: [bbb, ddd]
match function will be evaluated before filtering using mode
Source ​
packages/lit/src/utils/range-manager.ts:126
pointToRange() ​
pointToRange(
point
):null
|Range
Parameters ​
• point: TextRangePoint
Returns ​
null
| Range
Source ​
packages/lit/src/utils/range-manager.ts:202
renderRange() ​
renderRange(
start
,end
?):void
Parameters ​
• start: Range
• end?: null
| Range
Returns ​
void
Source ​
packages/lit/src/utils/range-manager.ts:46
syncRangeToTextSelection() ​
syncRangeToTextSelection(
range
,isRangeReversed
):null
|TextSelection
Parameters ​
• range: null
| Range
• isRangeReversed: boolean
Returns ​
null
| TextSelection
Source ​
packages/lit/src/utils/range-manager.ts:82
syncTextSelectionToRange() ​
syncTextSelectionToRange(
selection
):void
Parameters ​
• selection: null
| TextSelection
Returns ​
void
Source ​
packages/lit/src/utils/range-manager.ts:59
textSelectionToRange() ​
textSelectionToRange(
selection
):null
|Range
Parameters ​
• selection: TextSelection
Returns ​
null
| Range
Source ​
packages/lit/src/utils/range-manager.ts:179
Generated using typedoc-plugin-markdown and TypeDoc