@lvce-editor/editor-worker 19.77.3 → 19.77.5

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 CHANGED
@@ -17514,7 +17514,7 @@ const getSelections2 = editorUid => {
17514
17514
  } = editor;
17515
17515
  return selections;
17516
17516
  };
17517
- const setSelections2 = async (editorUid, selections) => {
17517
+ const setSelections2 = async (editorUid, selections, reveal = true) => {
17518
17518
  const requested = get$a(editorUid);
17519
17519
  if (!requested || requested.newState.lifecycle?.disposed) {
17520
17520
  return;
@@ -17529,7 +17529,10 @@ const setSelections2 = async (editorUid, selections) => {
17529
17529
  const {
17530
17530
  lifecycle
17531
17531
  } = editor;
17532
- const newEditor = setSelections$2(editor, selections);
17532
+ const newEditor = reveal ? setSelections$2(editor, selections) : {
17533
+ ...editor,
17534
+ selections
17535
+ };
17533
17536
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
17534
17537
  const current = get$a(editorUid);
17535
17538
  if (!current || lifecycle?.disposed || current.newState.lifecycle !== lifecycle) {
@@ -19127,11 +19130,13 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
19127
19130
  }, x, y, width, height, 9);
19128
19131
  const newEditor2 = setText$1(newEditor1, content);
19129
19132
  const newEditor3 = await updateHorizontalLayout(newEditor2);
19133
+ const savedDeltaY = savedState?.deltaY;
19134
+ const newEditor3WithScroll = typeof savedDeltaY === 'number' && Number.isFinite(savedDeltaY) && savedDeltaY >= 0 ? await setDeltaYFixedValue(newEditor3, savedDeltaY) : newEditor3;
19130
19135
 
19131
19136
  // Detect links and initialize decorations
19132
- const linkDecorations = detectAllLinksAsDecorations(newEditor3);
19137
+ const linkDecorations = detectAllLinksAsDecorations(newEditor3WithScroll);
19133
19138
  const newEditor3WithLinks = {
19134
- ...newEditor3,
19139
+ ...newEditor3WithScroll,
19135
19140
  decorations: linkDecorations
19136
19141
  };
19137
19142
  let documentSymbols = state.documentSymbols || [];
@@ -21001,6 +21006,7 @@ const saveState = async (state, hotReload) => {
21001
21006
  ...(largeFile && {
21002
21007
  largeFile: true
21003
21008
  }),
21009
+ deltaY,
21004
21010
  ...(widgets.length > 0 && {
21005
21011
  widgets
21006
21012
  }),
@@ -17933,7 +17933,7 @@ const getSelections2 = editorUid => {
17933
17933
  } = editor;
17934
17934
  return selections;
17935
17935
  };
17936
- const setSelections2 = async (editorUid, selections) => {
17936
+ const setSelections2 = async (editorUid, selections, reveal = true) => {
17937
17937
  const requested = get$9(editorUid);
17938
17938
  if (!requested || requested.newState.lifecycle?.disposed) {
17939
17939
  return;
@@ -17948,7 +17948,10 @@ const setSelections2 = async (editorUid, selections) => {
17948
17948
  const {
17949
17949
  lifecycle
17950
17950
  } = editor;
17951
- const newEditor = setSelections$2(editor, selections);
17951
+ const newEditor = reveal ? setSelections$2(editor, selections) : {
17952
+ ...editor,
17953
+ selections
17954
+ };
17952
17955
  const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
17953
17956
  const current = get$9(editorUid);
17954
17957
  if (!current || lifecycle?.disposed || current.newState.lifecycle !== lifecycle) {
@@ -19546,11 +19549,13 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
19546
19549
  }, x, y, width, height, 9);
19547
19550
  const newEditor2 = setText$1(newEditor1, content);
19548
19551
  const newEditor3 = await updateHorizontalLayout(newEditor2);
19552
+ const savedDeltaY = savedState?.deltaY;
19553
+ const newEditor3WithScroll = typeof savedDeltaY === 'number' && Number.isFinite(savedDeltaY) && savedDeltaY >= 0 ? await setDeltaYFixedValue(newEditor3, savedDeltaY) : newEditor3;
19549
19554
 
19550
19555
  // Detect links and initialize decorations
19551
- const linkDecorations = detectAllLinksAsDecorations(newEditor3);
19556
+ const linkDecorations = detectAllLinksAsDecorations(newEditor3WithScroll);
19552
19557
  const newEditor3WithLinks = {
19553
- ...newEditor3,
19558
+ ...newEditor3WithScroll,
19554
19559
  decorations: linkDecorations
19555
19560
  };
19556
19561
  let documentSymbols = state.documentSymbols || [];
@@ -21420,6 +21425,7 @@ const saveState = async (state, hotReload) => {
21420
21425
  ...(largeFile && {
21421
21426
  largeFile: true
21422
21427
  }),
21428
+ deltaY,
21423
21429
  ...(widgets.length > 0 && {
21424
21430
  widgets
21425
21431
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.77.3",
3
+ "version": "19.77.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"