@lvce-editor/main-area-worker 9.66.0 → 9.67.0

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.
@@ -2288,7 +2288,10 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2288
2288
  return newState;
2289
2289
  };
2290
2290
 
2291
- const saveEditor = async editorUid => {
2291
+ const saveEditor = async (editorUid, skipFormatting = false) => {
2292
+ if (skipFormatting) {
2293
+ return invoke$2('Editor.save', editorUid, true);
2294
+ }
2292
2295
  return invoke$2('Editor.save', editorUid);
2293
2296
  };
2294
2297
 
@@ -6434,7 +6437,7 @@ const parseTerminalDrag = strings => {
6434
6437
  }
6435
6438
  try {
6436
6439
  const data = JSON.parse(value.slice('lvce-terminal:'.length));
6437
- if (Number.isSafeInteger(data.sourceUid) && data.sourceUid > 0 && Number.isSafeInteger(data.terminalUid) && data.terminalUid > 0) {
6440
+ if (Number.isFinite(data.sourceUid) && data.sourceUid > 0 && Number.isFinite(data.terminalUid) && data.terminalUid > 0) {
6438
6441
  return data;
6439
6442
  }
6440
6443
  } catch {
@@ -8733,8 +8736,8 @@ const resize$1 = (state, dimensions) => {
8733
8736
  };
8734
8737
 
8735
8738
  const settingsUri = 'app://settings.json';
8736
- const saveEditorAndHandleSettingsChange = async (tab, applicationId) => {
8737
- const editorState = await saveEditor(tab.editorUid);
8739
+ const saveEditorAndHandleSettingsChange = async (tab, applicationId, skipFormatting = false) => {
8740
+ const editorState = await saveEditor(tab.editorUid, skipFormatting);
8738
8741
  if (!editorState?.modified && tab.uri === settingsUri) {
8739
8742
  await invoke$1(applicationId, 'Layout.handleSettingsChanged');
8740
8743
  }
@@ -8761,7 +8764,7 @@ const getLatestStoredState = (uid, fallbackState, referenceTabId, referenceTabUr
8761
8764
  }
8762
8765
  return fallbackState;
8763
8766
  };
8764
- const save = async state => {
8767
+ const saveInternal = async (state, skipFormatting) => {
8765
8768
  const {
8766
8769
  uid
8767
8770
  } = state;
@@ -8778,10 +8781,10 @@ const save = async state => {
8778
8781
  return currentState;
8779
8782
  }
8780
8783
  if (!tab.isDirty) {
8781
- await saveEditorAndHandleSettingsChange(tab, state.applicationId);
8784
+ await saveEditorAndHandleSettingsChange(tab, state.applicationId, skipFormatting);
8782
8785
  return getLatestStoredState(uid, currentState, tab.id, tab.uri);
8783
8786
  }
8784
- const editorState = await saveEditorAndHandleSettingsChange(tab, state.applicationId);
8787
+ const editorState = await saveEditorAndHandleSettingsChange(tab, state.applicationId, skipFormatting);
8785
8788
  const latestState = getLatestStoredState(uid, currentState, tab.id, tab.uri);
8786
8789
  if (editorState?.modified) {
8787
8790
  return latestState;
@@ -8794,6 +8797,12 @@ const save = async state => {
8794
8797
  isDirty: false
8795
8798
  });
8796
8799
  };
8800
+ const save = async state => {
8801
+ return saveInternal(state, false);
8802
+ };
8803
+ const saveWithoutFormatting = async state => {
8804
+ return saveInternal(state, true);
8805
+ };
8797
8806
 
8798
8807
  const getSavedTab = tab => {
8799
8808
  const normalizedTab = normalizeTabEditorInput(tab);
@@ -9215,6 +9224,7 @@ const commandMap = {
9215
9224
  'MainArea.restoreClosedTab': wrapSerialCommand(restoreClosedTab),
9216
9225
  'MainArea.save': wrapSerialCommand(save),
9217
9226
  'MainArea.saveState': wrapGetter(saveState),
9227
+ 'MainArea.saveWithoutFormatting': wrapSerialCommand(saveWithoutFormatting),
9218
9228
  'MainArea.selectTab': wrapSerialCommand(selectTab),
9219
9229
  'MainArea.setComponentState': setComponentState,
9220
9230
  'MainArea.setEditorLayoutGrid': wrapSerialCommand(setEditorLayoutGrid),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.66.0",
3
+ "version": "9.67.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",