@lvce-editor/editor-worker 19.77.8 → 19.77.9

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
@@ -6271,7 +6271,7 @@ const updateLines = (editor, lines) => {
6271
6271
  * @param {Uint32Array|undefined} selectionChanges
6272
6272
  * @returns
6273
6273
  */
6274
- const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined) => {
6274
+ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined, options = {}) => {
6275
6275
  object(editor);
6276
6276
  array(changes);
6277
6277
  if (changes.length === 0) {
@@ -6327,7 +6327,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
6327
6327
  set$b(editor.uid, editor, newEditorWithDecorations);
6328
6328
 
6329
6329
  // Notify main-area-worker about modified status change
6330
- if (!editor.modified) {
6330
+ if (!editor.modified && options.notifyModifiedStatusChange !== false) {
6331
6331
  await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
6332
6332
  }
6333
6333
 
@@ -9333,7 +9333,7 @@ const error = (...args) => {
9333
9333
  console.error(...args);
9334
9334
  };
9335
9335
 
9336
- const applyDocumentEdits$1 = (editor, edits) => {
9336
+ const applyDocumentEdits$1 = (editor, edits, options = {}) => {
9337
9337
  if (!Array.isArray(edits)) {
9338
9338
  warn('something is wrong with format on save', edits);
9339
9339
  return editor;
@@ -9346,7 +9346,7 @@ const applyDocumentEdits$1 = (editor, edits) => {
9346
9346
  ...editor
9347
9347
  }, documentEdits);
9348
9348
  const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
9349
- return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections);
9349
+ return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections, options);
9350
9350
  };
9351
9351
 
9352
9352
  const applyEdit = async (editor, changes, selectionChanges) => {
@@ -9879,11 +9879,17 @@ const formatAfterSave = async (uid, snapshot) => {
9879
9879
  if (staleReason) {
9880
9880
  return editor;
9881
9881
  }
9882
- const formattedEditor = await applyDocumentEdits$1(editor, edits);
9882
+ const formattedEditor = await applyDocumentEdits$1(editor, edits, {
9883
+ notifyModifiedStatusChange: false
9884
+ });
9883
9885
  if (formattedEditor === editor || getText$1(formattedEditor) === originalText) {
9884
9886
  return editor;
9885
9887
  }
9886
- return save$1(formattedEditor, true);
9888
+ const savedEditor = await save$1(formattedEditor, true);
9889
+ if (savedEditor === formattedEditor) {
9890
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
9891
+ }
9892
+ return savedEditor;
9887
9893
  });
9888
9894
  await applyFormatting(uid);
9889
9895
  };
@@ -6696,7 +6696,7 @@ const updateLines = (editor, lines) => {
6696
6696
  * @param {Uint32Array|undefined} selectionChanges
6697
6697
  * @returns
6698
6698
  */
6699
- const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined) => {
6699
+ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionChanges = undefined, options = {}) => {
6700
6700
  object(editor);
6701
6701
  array(changes);
6702
6702
  if (changes.length === 0) {
@@ -6752,7 +6752,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
6752
6752
  set$b(editor.uid, editor, newEditorWithDecorations);
6753
6753
 
6754
6754
  // Notify main-area-worker about modified status change
6755
- if (!editor.modified) {
6755
+ if (!editor.modified && options.notifyModifiedStatusChange !== false) {
6756
6756
  await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
6757
6757
  }
6758
6758
 
@@ -9758,7 +9758,7 @@ const error = (...args) => {
9758
9758
  console.error(...args);
9759
9759
  };
9760
9760
 
9761
- const applyDocumentEdits$1 = (editor, edits) => {
9761
+ const applyDocumentEdits$1 = (editor, edits, options = {}) => {
9762
9762
  if (!Array.isArray(edits)) {
9763
9763
  warn('something is wrong with format on save', edits);
9764
9764
  return editor;
@@ -9771,7 +9771,7 @@ const applyDocumentEdits$1 = (editor, edits) => {
9771
9771
  ...editor
9772
9772
  }, documentEdits);
9773
9773
  const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
9774
- return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections);
9774
+ return scheduleDocumentAndCursorsSelections(editor, documentEdits, selections, options);
9775
9775
  };
9776
9776
 
9777
9777
  const applyEdit = async (editor, changes, selectionChanges) => {
@@ -10299,11 +10299,17 @@ const formatAfterSave = async (uid, snapshot) => {
10299
10299
  if (staleReason) {
10300
10300
  return editor;
10301
10301
  }
10302
- const formattedEditor = await applyDocumentEdits$1(editor, edits);
10302
+ const formattedEditor = await applyDocumentEdits$1(editor, edits, {
10303
+ notifyModifiedStatusChange: false
10304
+ });
10303
10305
  if (formattedEditor === editor || getText$1(formattedEditor) === originalText) {
10304
10306
  return editor;
10305
10307
  }
10306
- return save$1(formattedEditor, true);
10308
+ const savedEditor = await save$1(formattedEditor, true);
10309
+ if (savedEditor === formattedEditor) {
10310
+ await notifyTabModifiedStatusChange(editor.uri, true, editor.applicationId);
10311
+ }
10312
+ return savedEditor;
10307
10313
  });
10308
10314
  await applyFormatting(uid);
10309
10315
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.77.8",
3
+ "version": "19.77.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"