BlockSuite API Documentation / @blocksuite/inline / domRangeToInlineRange
Function: domRangeToInlineRange() ​
domRangeToInlineRange(
range
,rootElement
,yText
):InlineRange
|null
calculate the inline range from dom selection for this Editor there are three cases when the inline range 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 inline range 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 inline range of first Editor is {index: 3, length: 3}, the second is {index: 0, length: 5}, the third is null 2.2 the inline range 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 inline range of first Editor is {index: 2, length: 4}, the second is {index: 0, length: 6}, the third is
Parameters ​
• range: Range
• rootElement: HTMLElement
• yText: Text
Returns ​
InlineRange
| null
Source ​
packages/inline/src/utils/range-conversion.ts:194
Generated using typedoc-plugin-markdown and TypeDoc