BlockSuite API Documentation / @blocksuite/inline / RangeService
Class: RangeService<TextAttributes>
Type Parameters
• TextAttributes extends BaseTextAttributes
Constructors
new RangeService()
new RangeService<
TextAttributes
>(editor
):RangeService
<TextAttributes
>
Parameters
• editor: InlineEditor
<TextAttributes
>
Returns
RangeService
<TextAttributes
>
Defined in
packages/framework/inline/src/services/range.ts:375
Properties
editor
readonly
editor:InlineEditor
<TextAttributes
>
Defined in
packages/framework/inline/src/services/range.ts:375
Accessors
lastEndRelativePosition
get
lastEndRelativePosition():null
|RelativePosition
Returns
null
| RelativePosition
Defined in
packages/framework/inline/src/services/range.ts:367
lastStartRelativePosition
get
lastStartRelativePosition():null
|RelativePosition
Returns
null
| RelativePosition
Defined in
packages/framework/inline/src/services/range.ts:371
Methods
focusEnd()
focusEnd():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:25
focusIndex()
focusIndex(
index
):void
Parameters
• index: number
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:32
focusStart()
focusStart():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:39
getInlineRangeFromElement()
getInlineRangeFromElement(
element
):null
|InlineRange
Parameters
• element: Element
Returns
null
| InlineRange
Defined in
packages/framework/inline/src/services/range.ts:46
getLine()
getLine(
rangeIndex
):null
|object
Parameters
• rangeIndex: number
Returns
null
| object
Defined in
packages/framework/inline/src/services/range.ts:61
getNativeRange()
getNativeRange():
null
|Range
Returns
null
| Range
Defined in
packages/framework/inline/src/services/range.ts:90
getNativeSelection()
getNativeSelection():
null
|Selection
Returns
null
| Selection
Defined in
packages/framework/inline/src/services/range.ts:96
getTextPoint()
getTextPoint(
rangeIndex
):null
|TextPoint
Parameters
• rangeIndex: number
Returns
null
| TextPoint
Defined in
packages/framework/inline/src/services/range.ts:104
isFirstLine()
isFirstLine(
inlineRange
):boolean
There are two cases to have the second line:
- long text auto wrap in span element
- soft break
Parameters
• inlineRange: null
| InlineRange
Returns
boolean
Defined in
packages/framework/inline/src/services/range.ts:136
isLastLine()
isLastLine(
inlineRange
):boolean
There are two cases to have the second line:
- long text auto wrap in span element
- soft break
Parameters
• inlineRange: null
| InlineRange
Returns
boolean
Defined in
packages/framework/inline/src/services/range.ts:178
isValidInlineRange()
isValidInlineRange(
inlineRange
):boolean
Parameters
• inlineRange: null
| InlineRange
Returns
boolean
Defined in
packages/framework/inline/src/services/range.ts:216
lockSyncInlineRange()
lockSyncInlineRange():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:270
mount()
mount():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:224
selectAll()
selectAll():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:262
syncInlineRange()
syncInlineRange(
inlineRange
?):void
sync the dom selection from inline range for this Editor
Parameters
• inlineRange?: null
| InlineRange
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:279
toDomRange()
toDomRange(
inlineRange
):null
|Range
calculate the dom selection from inline ranage for this Editor
Parameters
• inlineRange: InlineRange
Returns
null
| Range
Defined in
packages/framework/inline/src/services/range.ts:324
toInlineRange()
toInlineRange(
range
):null
|InlineRange
calculate the inline ranage from dom selection for this Editor there are three cases when the inline ranage of this Editor is not null: (In the following, "|" mean anchor and focus, each line is a separate Editor)
- anchor and focus are in this Editorthe inline ranage of second Editor is
aaaaaa b|bbbb|b cccccc
{index: 1, length: 4}
, the others are null - anchor and focus one in this Editor, one in another Editor2.1 the inline ranage of first Editor is
aaa|aaa aaaaaa bbbbb|b or bbbbb|b cccccc cc|cccc
{index: 3, length: 3}
, the second is{index: 0, length: 5}
, the third is null 2.2 the inline ranage of first Editor is null, the second is{index: 5, length: 1}
, the third is{index: 0, length: 2}
- anchor and focus are in another Editorthe inline range of first Editor is
aa|aaaa bbbbbb cccc|cc
{index: 2, length: 4}
, the second is{index: 0, length: 6}
, the third is{index: 0, length: 4}
Parameters
• range: Range
Returns
null
| InlineRange
Defined in
packages/framework/inline/src/services/range.ts:361
unlockSyncInlineRange()
unlockSyncInlineRange():
void
Returns
void
Defined in
packages/framework/inline/src/services/range.ts:273