@blocksuite/virgo
Advanced tools
Comparing version 0.5.0-20230312174558-52c15ca to 0.5.0-20230313100532-099b92b
@@ -83,3 +83,3 @@ import { Slot } from '@blocksuite/global/utils'; | ||
*/ | ||
toDomRange(vRange: VRange): Range | null; | ||
toDomRange(vRange: VRange, shouldScrollIntoView?: boolean): Range | null; | ||
/** | ||
@@ -86,0 +86,0 @@ * calculate the vRange from dom selection for **this Editor** |
import { assertExists, Slot } from '@blocksuite/global/utils'; | ||
import scrollIntoView from 'scroll-into-view-if-needed'; | ||
import { VirgoElement } from './components/virgo-element.js'; | ||
@@ -646,3 +647,3 @@ import { VirgoLine } from './components/virgo-line.js'; | ||
*/ | ||
toDomRange(vRange) { | ||
toDomRange(vRange, shouldScrollIntoView = true) { | ||
assertExists(this._rootElement); | ||
@@ -685,2 +686,5 @@ const lineElements = Array.from(this._rootElement.querySelectorAll('v-line')); | ||
range.setEnd(focusText, focusOffset); | ||
if (shouldScrollIntoView && focusText.parentElement) { | ||
scrollIntoView(focusText.parentElement, { scrollMode: 'if-needed' }); | ||
} | ||
return range; | ||
@@ -687,0 +691,0 @@ } |
{ | ||
"name": "@blocksuite/virgo", | ||
"version": "0.5.0-20230312174558-52c15ca", | ||
"version": "0.5.0-20230313100532-099b92b", | ||
"description": "A micro editor.", | ||
@@ -26,3 +26,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.5.0-20230312174558-52c15ca", | ||
"@blocksuite/global": "0.5.0-20230313100532-099b92b", | ||
"scroll-into-view-if-needed": "^3.0.6", | ||
"zod": "^3.20.6" | ||
@@ -29,0 +30,0 @@ }, |
import { assertExists, Slot } from '@blocksuite/global/utils'; | ||
import scrollIntoView from 'scroll-into-view-if-needed'; | ||
import type * as Y from 'yjs'; | ||
@@ -668,3 +669,3 @@ import type { z } from 'zod'; | ||
*/ | ||
toDomRange(vRange: VRange): Range | null { | ||
toDomRange(vRange: VRange, shouldScrollIntoView = true): Range | null { | ||
assertExists(this._rootElement); | ||
@@ -718,2 +719,7 @@ const lineElements = Array.from( | ||
range.setEnd(focusText, focusOffset); | ||
if (shouldScrollIntoView && focusText.parentElement) { | ||
scrollIntoView(focusText.parentElement, { scrollMode: 'if-needed' }); | ||
} | ||
return range; | ||
@@ -720,0 +726,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
367989
4922
5
+ Added@blocksuite/global@0.5.0-20230313100532-099b92b(transitive)
+ Addedcompute-scroll-into-view@3.1.0(transitive)
+ Addedscroll-into-view-if-needed@3.1.0(transitive)
- Removed@blocksuite/global@0.5.0-20230312174558-52c15ca(transitive)