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>
Source
packages/framework/inline/src/services/range.ts:47
Properties
_inlineRange
private_inlineRange:null|InlineRange=null
Source
packages/framework/inline/src/services/range.ts:41
_lastEndRelativePosition
private_lastEndRelativePosition:null|RelativePosition=null
Source
packages/framework/inline/src/services/range.ts:45
_lastStartRelativePosition
private_lastStartRelativePosition:null|RelativePosition=null
Source
packages/framework/inline/src/services/range.ts:43
editor
readonlyeditor:InlineEditor<TextAttributes>
Source
packages/framework/inline/src/services/range.ts:47
Accessors
inlineRangeProvider
getinlineRangeProvider():null|InlineRangeProvider
Returns
null | InlineRangeProvider
Source
packages/framework/inline/src/services/range.ts:25
lastEndRelativePosition
getlastEndRelativePosition():null|RelativePosition
Returns
null | RelativePosition
Source
packages/framework/inline/src/services/range.ts:37
lastStartRelativePosition
getlastStartRelativePosition():null|RelativePosition
Returns
null | RelativePosition
Source
packages/framework/inline/src/services/range.ts:33
rootElement
getrootElement():InlineRootElement<TextAttributes>
Returns
InlineRootElement<TextAttributes>
Source
packages/framework/inline/src/services/range.ts:29
yText
getyText():Text
Returns
Source
packages/framework/inline/src/services/range.ts:21
Methods
_applyInlineRange()
private_applyInlineRange(inlineRange):void
Parameters
• inlineRange: InlineRange
Returns
void
Source
packages/framework/inline/src/services/range.ts:49
focusEnd()
focusEnd():
void
Returns
void
Source
packages/framework/inline/src/services/range.ts:339
focusIndex()
focusIndex(
index):void
Parameters
• index: number
Returns
void
Source
packages/framework/inline/src/services/range.ts:360
focusStart()
focusStart():
void
Returns
void
Source
packages/framework/inline/src/services/range.ts:346
getInlineRange()
getInlineRange():
null|InlineRange
Returns
null | InlineRange
Source
packages/framework/inline/src/services/range.ts:150
getInlineRangeFromElement()
getInlineRangeFromElement(
element):null|InlineRange
Parameters
• element: Element
Returns
null | InlineRange
Source
packages/framework/inline/src/services/range.ts:158
getLine()
getLine(
rangeIndex):object
Parameters
• rangeIndex: number
Returns
object
line
line:
VLine
lineIndex
lineIndex:
number
rangeIndexRelatedToLine
rangeIndexRelatedToLine:
number
Source
packages/framework/inline/src/services/range.ts:199
getNativeRange()
getNativeRange():
null|Range
Returns
null | Range
Source
packages/framework/inline/src/services/range.ts:144
getNativeSelection()
getNativeSelection():
null|Selection
Returns
null | Selection
Source
packages/framework/inline/src/services/range.ts:136
getTextPoint()
getTextPoint(
rangeIndex):TextPoint
Parameters
• rangeIndex: number
Returns
Source
packages/framework/inline/src/services/range.ts:172
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
Source
packages/framework/inline/src/services/range.ts:239
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
Source
packages/framework/inline/src/services/range.ts:283
isValidInlineRange()
isValidInlineRange(
inlineRange):boolean
Parameters
• inlineRange: null | InlineRange
Returns
boolean
Source
packages/framework/inline/src/services/range.ts:226
onInlineRangeUpdated()
onInlineRangeUpdated(
__namedParameters):Promise<void>
Parameters
• __namedParameters: InlineRangeUpdatedProp
Returns
Promise<void>
Source
packages/framework/inline/src/services/range.ts:65
selectAll()
selectAll():
void
Returns
void
Source
packages/framework/inline/src/services/range.ts:353
setInlineRange()
setInlineRange(
inlineRange,sync):void
the inline ranage is synced to the native selection asynchronically if sync is true, the native selection will be synced immediately
Parameters
• inlineRange: null | InlineRange
• sync: boolean= true
Returns
void
Source
packages/framework/inline/src/services/range.ts:326
syncInlineRange()
syncInlineRange():
void
sync the dom selection from inline ranage for this Editor
Returns
void
Source
packages/framework/inline/src/services/range.ts:370
toDomRange()
toDomRange(
inlineRange):null|Range
calculate the dom selection from inline ranage for this Editor
Parameters
• inlineRange: InlineRange
Returns
null | Range
Source
packages/framework/inline/src/services/range.ts:380
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
Source
packages/framework/inline/src/services/range.ts:417