BlockSuite API Documentation / @blocksuite/block-std / RangeManager
Class: RangeManager
CRUD for Range and TextSelection
Constructors
new RangeManager(host)
new RangeManager(
host
):RangeManager
Parameters
• host: EditorHost
Returns
Source
packages/framework/block-std/src/view/utils/range-manager.ts:24
Properties
binding
readonly
binding:RangeBinding
Source
packages/framework/block-std/src/view/utils/range-manager.ts:22
host
host:
EditorHost
Source
packages/framework/block-std/src/view/utils/range-manager.ts:24
rangeQueryExcludeAttr
static
rangeQueryExcludeAttr:string
='data-range-query-exclude'
Used to exclude certain elements when using getSelectedBlockElementsByRange
.
Source
packages/framework/block-std/src/view/utils/range-manager.ts:20
rangeSyncExcludeAttr
static
rangeSyncExcludeAttr:string
='data-range-sync-exclude'
Used to mark certain elements so that they are excluded when synchronizing the native range and text selection (such as database block).
Source
packages/framework/block-std/src/view/utils/range-manager.ts:16
Accessors
value
get
value():null
|Range
Returns
null
| Range
Source
packages/framework/block-std/src/view/utils/range-manager.ts:26
Methods
_isRangeSyncExcluded()
private
_isRangeSyncExcluded(el
):boolean
Parameters
• el: Element
Returns
boolean
Source
packages/framework/block-std/src/view/utils/range-manager.ts:253
clear()
clear():
void
Returns
void
Source
packages/framework/block-std/src/view/utils/range-manager.ts:33
getClosestBlock()
getClosestBlock(
node
):null
|BlockElement
<BlockModel
<object
>,BlockService
<BlockModel
<object
>>,string
>
Parameters
• node: Node
Returns
null
| BlockElement
<BlockModel
<object
>, BlockService
<BlockModel
<object
>>, string
>
Source
packages/framework/block-std/src/view/utils/range-manager.ts:220
getClosestInlineEditor()
getClosestInlineEditor(
node
):null
|InlineEditor
<object
>
Parameters
• node: Node
Returns
null
| InlineEditor
<object
>
Source
packages/framework/block-std/src/view/utils/range-manager.ts:228
getSelectedBlockElementsByRange()
getSelectedBlockElementsByRange(
range
,options
):BlockElement
<BlockModel
<object
>,BlockService
<BlockModel
<object
>>,string
>[]
Parameters
• range: Range
• options= {}
• options.match?
• options.mode?: "flat"
| "all"
| "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/framework/block-std/src/view/utils/range-manager.ts:95
queryInlineEditorByPath()
queryInlineEditorByPath(
path
):null
|InlineEditor
<object
>
Parameters
• path: string
[]
Returns
null
| InlineEditor
<object
>
Source
packages/framework/block-std/src/view/utils/range-manager.ts:239
rangeToTextSelection()
rangeToTextSelection(
range
,reverse
):null
|TextSelection
Parameters
• range: Range
• reverse: boolean
= false
Returns
null
| TextSelection
Source
packages/framework/block-std/src/view/utils/range-manager.ts:181
set()
set(
range
):void
Parameters
• range: Range
Returns
void
Source
packages/framework/block-std/src/view/utils/range-manager.ts:49
syncRangeToTextSelection()
syncRangeToTextSelection(
range
,isRangeReversed
):void
Parameters
• range: Range
• isRangeReversed: boolean
Returns
void
Source
packages/framework/block-std/src/view/utils/range-manager.ts:65
syncTextSelectionToRange()
syncTextSelectionToRange(
selection
):void
Parameters
• selection: TextSelection
Returns
void
Source
packages/framework/block-std/src/view/utils/range-manager.ts:56
textSelectionToRange()
textSelectionToRange(
selection
):null
|Range
Parameters
• selection: TextSelection
Returns
null
| Range
Source
packages/framework/block-std/src/view/utils/range-manager.ts:142