BlockSuite API Documentation / @blocksuite/virgo / VirgoRangeService
Class: VirgoRangeService<TextAttributes> ​
Contents ​
Type parameters ​
• TextAttributes extends BaseTextAttributes
Constructors ​
new VirgoRangeService(editor) ​
new VirgoRangeService<
TextAttributes>(editor):VirgoRangeService<TextAttributes>
Parameters ​
• editor: VEditor<TextAttributes>
Returns ​
VirgoRangeService<TextAttributes>
Source ​
packages/virgo/src/services/range.ts:18
Properties ​
_vRange ​
private_vRange:null|VRange=null
Source ​
packages/virgo/src/services/range.ts:16
editor ​
readonlyeditor:VEditor<TextAttributes>
Source ​
packages/virgo/src/services/range.ts:18
Accessors ​
rootElement ​
getrootElement():VirgoRootElement<TextAttributes>
Returns ​
VirgoRootElement<TextAttributes>
Source ​
packages/virgo/src/services/range.ts:24
vRangeProvider ​
getvRangeProvider():null|VRangeProvider
Returns ​
null | VRangeProvider
Source ​
packages/virgo/src/services/range.ts:20
Methods ​
_applyVRange() ​
private_applyVRange(vRange):void
Parameters ​
• vRange: VRange
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:340
focusEnd() ​
focusEnd():
void
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:262
focusIndex() ​
focusIndex(
index):void
Parameters ​
• index: number
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:283
focusStart() ​
focusStart():
void
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:269
getLine() ​
getLine(
rangeIndex): readonly [VirgoLine,number]
Parameters ​
• rangeIndex: number
Returns ​
readonly [VirgoLine, number]
Source ​
packages/virgo/src/services/range.ts:127
getNativeSelection() ​
getNativeSelection():
null|Selection
Returns ​
null | Selection
Source ​
packages/virgo/src/services/range.ts:72
getTextPoint() ​
getTextPoint(
rangeIndex):TextPoint
Parameters ​
• rangeIndex: number
Returns ​
Source ​
packages/virgo/src/services/range.ts:103
getVRange() ​
getVRange():
null|VRange
Returns ​
null | VRange
Source ​
packages/virgo/src/services/range.ts:81
getVRangeFromElement() ​
getVRangeFromElement(
element):null|VRange
Parameters ​
• element: Element
Returns ​
null | VRange
Source ​
packages/virgo/src/services/range.ts:89
isFirstLine() ​
isFirstLine(
vRange):boolean
There are two cases to have the second line:
- long text auto wrap in span element
- soft break
Parameters ​
• vRange: null | VRange
Returns ​
boolean
Source ​
packages/virgo/src/services/range.ts:162
isLastLine() ​
isLastLine(
vRange):boolean
There are two cases to have the second line:
- long text auto wrap in span element
- soft break
Parameters ​
• vRange: null | VRange
Returns ​
boolean
Source ​
packages/virgo/src/services/range.ts:206
isVRangeValid() ​
isVRangeValid(
vRange):boolean
Parameters ​
• vRange: null | VRange
Returns ​
boolean
Source ​
packages/virgo/src/services/range.ts:149
onVRangeUpdated() ​
onVRangeUpdated(
__namedParameters):Promise<void>
Parameters ​
• __namedParameters: VRangeUpdatedProp
Returns ​
Promise<void>
Source ​
packages/virgo/src/services/range.ts:28
selectAll() ​
selectAll():
void
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:276
setVRange() ​
setVRange(
vRange,sync):void
the vRange is synced to the native selection asynchronically if sync is true, the native selection will be synced immediately
Parameters ​
• vRange: null | VRange
• sync: boolean= true
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:249
syncVRange() ​
syncVRange():
void
sync the dom selection from vRange for this Editor
Returns ​
void
Source ​
packages/virgo/src/services/range.ts:293
toDomRange() ​
toDomRange(
vRange):null|Range
calculate the dom selection from vRange for this Editor
Parameters ​
• vRange: VRange
Returns ​
null | Range
Source ​
packages/virgo/src/services/range.ts:303
toVRange() ​
toVRange(
range):null|VRange
calculate the vRange from dom selection for this Editor there are three cases when the vRange 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 Editor aaaaaa b|bbbb|b cccccc the vRange of second Editor is {index: 1, length: 4}, the others are null
- anchor and focus one in this Editor, one in another Editor aaa|aaa aaaaaa bbbbb|b or bbbbb|b cccccc cc|cccc 2.1 the vRange of first Editor is {index: 3, length: 3}, the second is {index: 0, length: 5}, the third is null 2.2 the vRange of first Editor is null, the second is {index: 5, length: 1}, the third is
- anchor and focus are in another Editor aa|aaaa bbbbbb cccc|cc the vRange of first Editor is {index: 2, length: 4}, the second is {index: 0, length: 6}, the third is
Parameters ​
• range: Range
Returns ​
null | VRange
Source ​
packages/virgo/src/services/range.ts:334
Generated using typedoc-plugin-markdown and TypeDoc