slate-angular 20.2.0-next.6 → 20.2.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2752,19 +2752,21 @@ class SlateEditable {
|
|
|
2752
2752
|
}
|
|
2753
2753
|
toNativeSelection() {
|
|
2754
2754
|
try {
|
|
2755
|
-
let { selection
|
|
2756
|
-
|
|
2757
|
-
if (this.virtualConfig?.enabled) {
|
|
2755
|
+
let { selection } = this.editor;
|
|
2756
|
+
if (this.virtualConfig?.enabled && selection) {
|
|
2758
2757
|
const indics = Array.from(this.virtualVisibleIndexes.values());
|
|
2759
2758
|
if (indics.length > 0) {
|
|
2760
2759
|
const currentVisibleRange = {
|
|
2761
2760
|
anchor: Editor.start(this.editor, [indics[0]]),
|
|
2762
2761
|
focus: Editor.end(this.editor, [indics[indics.length - 1]])
|
|
2763
2762
|
};
|
|
2764
|
-
|
|
2765
|
-
|
|
2763
|
+
const [start, end] = Range.edges(selection);
|
|
2764
|
+
const forwardSelection = { anchor: start, focus: end };
|
|
2765
|
+
const intersectedSelection = Range.intersection(forwardSelection, currentVisibleRange);
|
|
2766
|
+
if (!intersectedSelection || !Range.equals(intersectedSelection, forwardSelection)) {
|
|
2767
|
+
selection = intersectedSelection;
|
|
2766
2768
|
if (isDebug) {
|
|
2767
|
-
console.log(`selection is not in visible range, selection: ${JSON.stringify(
|
|
2769
|
+
console.log(`selection is not in visible range, selection: ${JSON.stringify(selection)}, intersectedSelection: ${JSON.stringify(intersectedSelection)}`);
|
|
2768
2770
|
}
|
|
2769
2771
|
}
|
|
2770
2772
|
}
|