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:17


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:15

Accessors

value

Get Signature

get value(): undefined | null | Range

Returns

undefined | null | Range

Defined in

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

Methods

clear()

clear(): void

Returns

void

Defined in

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


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:48


getClosestInlineEditor()

getClosestInlineEditor(node): null | InlineEditor<{ bold: null | true; code: null | true; italic: null | true; link: null | string; strike: null | true; underline: null | true; }>

Parameters

node

Node

Returns

null | InlineEditor<{ bold: null | true; code: null | true; italic: null | true; link: null | string; strike: null | true; underline: null | true; }>

Defined in

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


getSelectedBlockComponentsByRange()

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

Parameters

range

Range

options
match

(el) => boolean

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:82


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:131


queryInlineEditorByPath()

queryInlineEditorByPath(path): null | InlineEditor<{ bold: null | true; code: null | true; italic: null | true; link: null | string; strike: null | true; underline: null | true; }>

Parameters

path

string

Returns

null | InlineEditor<{ bold: null | true; code: null | true; italic: null | true; link: null | string; strike: null | true; underline: null | true; }>

Defined in

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


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:149


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:188


syncRangeToTextSelection()

syncRangeToTextSelection(range, isRangeReversed): void

Parameters

range

Range

isRangeReversed

boolean

Returns

void

Defined in

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


syncTextSelectionToRange()

syncTextSelectionToRange(selection): void

Parameters

selection

TextSelection

Returns

void

Defined in

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


textSelectionToRange()

textSelectionToRange(selection): null | Range

Parameters

selection

TextSelection

Returns

null | Range

Defined in

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


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