Skip to content

BlockSuite API Documentation / @blocksuite/block-std / RangeManager

Class: RangeManager

CRUD for Range and TextSelection

Extends

Constructors

new RangeManager()

new RangeManager(std): RangeManager

Parameters

std: BlockStdScope

Returns

RangeManager

Inherited from

LifeCycleWatcher.constructor

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:30

Properties

binding

binding: null | RangeBinding = null

Defined in

packages/framework/block-std/src/range/range-manager.ts:18


std

readonly std: BlockStdScope

Inherited from

LifeCycleWatcher.std

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:30


key

readonly static key: "rangeManager" = 'rangeManager'

Overrides

LifeCycleWatcher.key

Defined in

packages/framework/block-std/src/range/range-manager.ts:16

Accessors

value

get value(): undefined | null | Range

Returns

undefined | null | Range

Defined in

packages/framework/block-std/src/range/range-manager.ts:20

Methods

clear()

clear(): void

Returns

void

Defined in

packages/framework/block-std/src/range/range-manager.ts:33


created()

created(): void

Called when std is created.

Returns

void

Inherited from

LifeCycleWatcher.created

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:54


getClosestBlock()

getClosestBlock(node): null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Parameters

node: Node

Returns

null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>

Defined in

packages/framework/block-std/src/range/range-manager.ts:49


getClosestInlineEditor()

getClosestInlineEditor(node): null | InlineEditor<object>

Parameters

node: Node

Returns

null | InlineEditor<object>

Defined in

packages/framework/block-std/src/range/range-manager.ts:58


getSelectedBlockComponentsByRange()

getSelectedBlockComponentsByRange(range, options): BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>[]

Parameters

range: Range

options = {}

options.match?

options.mode?: "flat" | "all" | "highest"

Returns

BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>[]

Example

ts
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

Defined in

packages/framework/block-std/src/range/range-manager.ts:83


mounted()

mounted(): void

Called when editor host is mounted. Which means the editor host emit the connectedCallback lifecycle event.

Returns

void

Overrides

LifeCycleWatcher.mounted

Defined in

packages/framework/block-std/src/range/range-manager.ts:135


queryInlineEditorByPath()

queryInlineEditorByPath(path): null | InlineEditor<object>

Parameters

path: string

Returns

null | InlineEditor<object>

Defined in

packages/framework/block-std/src/range/range-manager.ts:139


rangeToTextSelection()

rangeToTextSelection(range, reverse): null | TextSelection

Parameters

range: Range

reverse: boolean = false

Returns

null | TextSelection

Defined in

packages/framework/block-std/src/range/range-manager.ts:153


rendered()

rendered(): void

Called when std.render is called.

Returns

void

Inherited from

LifeCycleWatcher.rendered

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:65


set()

set(range): void

Parameters

range: Range

Returns

void

Defined in

packages/framework/block-std/src/range/range-manager.ts:192


syncRangeToTextSelection()

syncRangeToTextSelection(range, isRangeReversed): void

Parameters

range: Range

isRangeReversed: boolean

Returns

void

Defined in

packages/framework/block-std/src/range/range-manager.ts:199


syncTextSelectionToRange()

syncTextSelectionToRange(selection): void

Parameters

selection: TextSelection

Returns

void

Defined in

packages/framework/block-std/src/range/range-manager.ts:215


textSelectionToRange()

textSelectionToRange(selection): null | Range

Parameters

selection: TextSelection

Returns

null | Range

Defined in

packages/framework/block-std/src/range/range-manager.ts:224


unmounted()

unmounted(): void

Called when editor host is unmounted. Which means the editor host emit the disconnectedCallback lifecycle event.

Returns

void

Inherited from

LifeCycleWatcher.unmounted

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:71


setup()

static setup(di): void

Parameters

di: Container

Returns

void

Inherited from

LifeCycleWatcher.setup

Defined in

packages/framework/block-std/src/extension/lifecycle-watcher.ts:34