Skip to content

BlockSuite API Documentation / @blocksuite/lit / RangeManager

Class: RangeManager

CRUD for Range and TextSelection

Constructors

new RangeManager(host)

new RangeManager(host): RangeManager

Parameters

host: EditorHost

Returns

RangeManager

Source

packages/framework/lit/src/utils/range-manager.ts:18

Properties

binding

readonly binding: RangeBinding

Source

packages/framework/lit/src/utils/range-manager.ts:16


host

host: EditorHost

Source

packages/framework/lit/src/utils/range-manager.ts:18


rangeQueryExcludeAttr

static rangeQueryExcludeAttr: string = 'data-range-query-exclude'

Source

packages/framework/lit/src/utils/range-manager.ts:14


rangeSyncExcludeAttr

static rangeSyncExcludeAttr: string = 'data-range-sync-exclude'

Source

packages/framework/lit/src/utils/range-manager.ts:13

Accessors

value

get value(): null | Range

Returns

null | Range

Source

packages/framework/lit/src/utils/range-manager.ts:20

Methods

clear()

clear(): void

Returns

void

Source

packages/framework/lit/src/utils/range-manager.ts:27


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/lit/src/utils/range-manager.ts:214


getClosestInlineEditor()

getClosestInlineEditor(node): null | InlineEditor<Object>

Parameters

node: Node

Returns

null | InlineEditor<Object>

Source

packages/framework/lit/src/utils/range-manager.ts:223


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

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

Source

packages/framework/lit/src/utils/range-manager.ts:89


queryInlineEditorByPath()

queryInlineEditorByPath(path): null | InlineEditor<Object>

Parameters

path: string[]

Returns

null | InlineEditor<Object>

Source

packages/framework/lit/src/utils/range-manager.ts:236


rangeToTextSelection()

rangeToTextSelection(range, reverse): null | TextSelection

Parameters

range: Range

reverse: boolean= false

Returns

null | TextSelection

Source

packages/framework/lit/src/utils/range-manager.ts:175


set()

set(range): void

Parameters

range: Range

Returns

void

Source

packages/framework/lit/src/utils/range-manager.ts:43


syncRangeToTextSelection()

syncRangeToTextSelection(range, isRangeReversed): void

Parameters

range: Range

isRangeReversed: boolean

Returns

void

Source

packages/framework/lit/src/utils/range-manager.ts:59


syncTextSelectionToRange()

syncTextSelectionToRange(selection): void

Parameters

selection: TextSelection

Returns

void

Source

packages/framework/lit/src/utils/range-manager.ts:50


textSelectionToRange()

textSelectionToRange(selection): null | Range

Parameters

selection: TextSelection

Returns

null | Range

Source

packages/framework/lit/src/utils/range-manager.ts:136


Generated using TypeDoc and typedoc-plugin-markdown.