@lvce-editor/editor-worker 19.75.2 → 19.75.3
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.
- package/dist/diff-sdk.js +7 -5
- package/dist/editorWorkerMain.js +7 -5
- package/package.json +1 -1
package/dist/diff-sdk.js
CHANGED
|
@@ -4741,7 +4741,7 @@ const getSelectionFromChange = change => {
|
|
|
4741
4741
|
start: newPosition
|
|
4742
4742
|
};
|
|
4743
4743
|
};
|
|
4744
|
-
const setSelections$2 = (editor, selections) => {
|
|
4744
|
+
const setSelections$2 = (editor, selections, centerOffscreenSelection = false) => {
|
|
4745
4745
|
object(editor);
|
|
4746
4746
|
const {
|
|
4747
4747
|
foldingRanges = []
|
|
@@ -4767,10 +4767,12 @@ const setSelections$2 = (editor, selections) => {
|
|
|
4767
4767
|
selections: normalizedSelections
|
|
4768
4768
|
};
|
|
4769
4769
|
}
|
|
4770
|
-
const desiredStartVisualRow = visualRow < startVisualRow ? visualRow : visualRow - editor.numberOfVisibleLines + 1;
|
|
4770
|
+
const desiredStartVisualRow = centerOffscreenSelection ? visualRow - Math.floor(editor.numberOfVisibleLines / 2) : visualRow < startVisualRow ? visualRow : visualRow - editor.numberOfVisibleLines + 1;
|
|
4771
|
+
const desiredDeltaY = desiredStartVisualRow * editor.itemHeight;
|
|
4772
|
+
const deltaY = centerOffscreenSelection ? clamp(desiredDeltaY, 0, editor.finalDeltaY ?? 0) : desiredDeltaY;
|
|
4771
4773
|
return updateLayout({
|
|
4772
4774
|
...editor,
|
|
4773
|
-
deltaY
|
|
4775
|
+
deltaY,
|
|
4774
4776
|
selections: normalizedSelections
|
|
4775
4777
|
}, foldingRanges);
|
|
4776
4778
|
}
|
|
@@ -4800,7 +4802,7 @@ const setSelections$2 = (editor, selections) => {
|
|
|
4800
4802
|
lines,
|
|
4801
4803
|
scrollBarHeight
|
|
4802
4804
|
} = editor;
|
|
4803
|
-
const desiredMinLineY = rowIndex < minLineY ? rowIndex : rowIndex - numberOfVisibleLines + 1;
|
|
4805
|
+
const desiredMinLineY = centerOffscreenSelection ? rowIndex - Math.floor(numberOfVisibleLines / 2) : rowIndex < minLineY ? rowIndex : rowIndex - numberOfVisibleLines + 1;
|
|
4804
4806
|
const deltaY = clamp(desiredMinLineY * itemHeight, 0, finalDeltaY);
|
|
4805
4807
|
const newMinLineY = Math.floor(deltaY / itemHeight);
|
|
4806
4808
|
const newMaxLineY = Math.min(newMinLineY + numberOfVisibleLines, lines.length);
|
|
@@ -12632,7 +12634,7 @@ const getFindWidgetFontSize = async () => {
|
|
|
12632
12634
|
};
|
|
12633
12635
|
const setSelections$1 = async (editorUid, selections) => {
|
|
12634
12636
|
const editor = getEditor$1(editorUid);
|
|
12635
|
-
const newEditor = setSelections$2(editor, selections);
|
|
12637
|
+
const newEditor = setSelections$2(editor, selections, true);
|
|
12636
12638
|
await updateEditor(editorUid, editor, newEditor);
|
|
12637
12639
|
};
|
|
12638
12640
|
|
package/dist/editorWorkerMain.js
CHANGED
|
@@ -5154,7 +5154,7 @@ const getSelectionFromChange = change => {
|
|
|
5154
5154
|
start: newPosition
|
|
5155
5155
|
};
|
|
5156
5156
|
};
|
|
5157
|
-
const setSelections$2 = (editor, selections) => {
|
|
5157
|
+
const setSelections$2 = (editor, selections, centerOffscreenSelection = false) => {
|
|
5158
5158
|
object(editor);
|
|
5159
5159
|
const {
|
|
5160
5160
|
foldingRanges = []
|
|
@@ -5180,10 +5180,12 @@ const setSelections$2 = (editor, selections) => {
|
|
|
5180
5180
|
selections: normalizedSelections
|
|
5181
5181
|
};
|
|
5182
5182
|
}
|
|
5183
|
-
const desiredStartVisualRow = visualRow < startVisualRow ? visualRow : visualRow - editor.numberOfVisibleLines + 1;
|
|
5183
|
+
const desiredStartVisualRow = centerOffscreenSelection ? visualRow - Math.floor(editor.numberOfVisibleLines / 2) : visualRow < startVisualRow ? visualRow : visualRow - editor.numberOfVisibleLines + 1;
|
|
5184
|
+
const desiredDeltaY = desiredStartVisualRow * editor.itemHeight;
|
|
5185
|
+
const deltaY = centerOffscreenSelection ? clamp(desiredDeltaY, 0, editor.finalDeltaY ?? 0) : desiredDeltaY;
|
|
5184
5186
|
return updateLayout({
|
|
5185
5187
|
...editor,
|
|
5186
|
-
deltaY
|
|
5188
|
+
deltaY,
|
|
5187
5189
|
selections: normalizedSelections
|
|
5188
5190
|
}, foldingRanges);
|
|
5189
5191
|
}
|
|
@@ -5213,7 +5215,7 @@ const setSelections$2 = (editor, selections) => {
|
|
|
5213
5215
|
lines,
|
|
5214
5216
|
scrollBarHeight
|
|
5215
5217
|
} = editor;
|
|
5216
|
-
const desiredMinLineY = rowIndex < minLineY ? rowIndex : rowIndex - numberOfVisibleLines + 1;
|
|
5218
|
+
const desiredMinLineY = centerOffscreenSelection ? rowIndex - Math.floor(numberOfVisibleLines / 2) : rowIndex < minLineY ? rowIndex : rowIndex - numberOfVisibleLines + 1;
|
|
5217
5219
|
const deltaY = clamp(desiredMinLineY * itemHeight, 0, finalDeltaY);
|
|
5218
5220
|
const newMinLineY = Math.floor(deltaY / itemHeight);
|
|
5219
5221
|
const newMaxLineY = Math.min(newMinLineY + numberOfVisibleLines, lines.length);
|
|
@@ -13036,7 +13038,7 @@ const getFindWidgetFontSize = async () => {
|
|
|
13036
13038
|
};
|
|
13037
13039
|
const setSelections$1 = async (editorUid, selections) => {
|
|
13038
13040
|
const editor = getEditor$1(editorUid);
|
|
13039
|
-
const newEditor = setSelections$2(editor, selections);
|
|
13041
|
+
const newEditor = setSelections$2(editor, selections, true);
|
|
13040
13042
|
await updateEditor(editorUid, editor, newEditor);
|
|
13041
13043
|
};
|
|
13042
13044
|
|