BlockSuite API Documentation / @blocksuite/lit / RangeManager
Class: RangeManager
CRUD for Range and TextSelection
Contents
Constructors
new RangeManager(host)
new RangeManager(
host
):RangeManager
Parameters
• host: EditorHost
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
host
host:
EditorHost
Source
packages/lit/src/utils/range-manager.ts:28
rangeSynchronizer
readonly
rangeSynchronizer:RangeSynchronizer
Source
packages/lit/src/utils/range-manager.ts:26
Accessors
value
get
value():null
|Range
Returns
null
| Range
Source
packages/lit/src/utils/range-manager.ts:30
Methods
_calculateInlineEditor()
private
_calculateInlineEditor(point
):null
| [InlineEditor
<Object
>,InlineRange
]
Parameters
• point: TextRangePoint
Returns
null
| [InlineEditor
<Object
>, InlineRange
]
Source
packages/lit/src/utils/range-manager.ts:212
_getBlock()
private
_getBlock(element
):BlockElement
<BlockModel
<object
>,BlockService
<BlockModel
<object
>>,string
>
Parameters
• element: HTMLElement
Returns
BlockElement
<BlockModel
<object
>, BlockService
<BlockModel
<object
>>, string
>
Source
packages/lit/src/utils/range-manager.ts:358
_getNearestInlineEditor()
private
_getNearestInlineEditor(node
):undefined
|InlineRootElement
Parameters
• node: Node
Returns
undefined
| InlineRootElement
Source
packages/lit/src/utils/range-manager.ts:344
_mergeRanges()
private
_mergeRanges(ranges
):null
|Object
Parameters
• ranges: RangeSnapshot
[]
Returns
null
| Object
Source
packages/lit/src/utils/range-manager.ts:272
_nodeToPoint()
private
_nodeToPoint(node
):null
|Object
Parameters
• node: Node
Returns
null
| Object
Source
packages/lit/src/utils/range-manager.ts:241
_renderRange()
private
_renderRange():void
Returns
void
Source
packages/lit/src/utils/range-manager.ts:325
_snapshotToRange()
private
_snapshotToRange(snapshot
):Range
Parameters
• snapshot: RangeSnapshot
Returns
Range
Source
packages/lit/src/utils/range-manager.ts:265
clearRange()
clearRange(
sync
):void
Parameters
• sync: boolean
= true
Returns
void
Source
packages/lit/src/utils/range-manager.ts:37
getSelectedBlockElementsByRange()
getSelectedBlockElementsByRange(
range
,options
):BlockElement
<BlockModel
<object
>,BlockService
<BlockModel
<object
>>,string
>[]
Parameters
• range: Range
• options: Object
= {}
• options.match?: (el
) => boolean
• options.mode?: "all"
| "flat"
| "highest"
Returns
BlockElement
<BlockModel
<object
>, BlockService
<BlockModel
<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