@lvce-editor/editor-worker 19.62.0 → 19.62.2
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/editorWorkerMain.js +18 -10
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -718,7 +718,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
718
718
|
}
|
|
719
719
|
};
|
|
720
720
|
const restoreMessageError = (error, _currentStack) => {
|
|
721
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
721
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
722
722
|
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
723
723
|
Object.defineProperty(restoredError, 'code', {
|
|
724
724
|
configurable: true,
|
|
@@ -806,7 +806,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
806
806
|
data: {
|
|
807
807
|
code: prettyError.code ?? error?.code,
|
|
808
808
|
codeFrame: prettyError.codeFrame,
|
|
809
|
-
name: prettyError.name,
|
|
809
|
+
name: prettyError.name ?? error?.name,
|
|
810
810
|
stack: getStack(prettyError),
|
|
811
811
|
type: getErrorType(prettyError)
|
|
812
812
|
},
|
|
@@ -12086,7 +12086,7 @@ const getSnippetChanges = (lines, selections, snippet) => {
|
|
|
12086
12086
|
});
|
|
12087
12087
|
} else {
|
|
12088
12088
|
const inserted = line.replace('$0', '');
|
|
12089
|
-
const cursorColumnIndex =
|
|
12089
|
+
const cursorColumnIndex = selectionStartColumn - snippet.deleted + placeholderIndex;
|
|
12090
12090
|
selectionChanges.push(selectionStartRow, cursorColumnIndex, selectionStartRow, cursorColumnIndex);
|
|
12091
12091
|
changes.push({
|
|
12092
12092
|
deleted: [''],
|
|
@@ -16557,7 +16557,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
16557
16557
|
return;
|
|
16558
16558
|
}
|
|
16559
16559
|
let didSave = false;
|
|
16560
|
-
const save$1 = wrapCommand(async editor => {
|
|
16560
|
+
const save$1 = wrapCommand$1(async editor => {
|
|
16561
16561
|
if (!isLatest(uid, token)) {
|
|
16562
16562
|
return editor;
|
|
16563
16563
|
}
|
|
@@ -16579,7 +16579,7 @@ const saveAfterDelay = async (uid, token) => {
|
|
|
16579
16579
|
// TODO wrap commands globally, not per editor
|
|
16580
16580
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
16581
16581
|
|
|
16582
|
-
const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...args) => {
|
|
16582
|
+
const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true) => async (uid, ...args) => {
|
|
16583
16583
|
return enqueue(uid, async () => {
|
|
16584
16584
|
const oldInstance = get$8(uid);
|
|
16585
16585
|
if (!oldInstance) {
|
|
@@ -16617,7 +16617,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
|
|
|
16617
16617
|
};
|
|
16618
16618
|
}
|
|
16619
16619
|
if (state === newEditor) {
|
|
16620
|
-
return newEditor;
|
|
16620
|
+
return returnState ? newEditor : undefined;
|
|
16621
16621
|
}
|
|
16622
16622
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
|
|
16623
16623
|
set$8(uid, state, newEditorWithDerivedState);
|
|
@@ -16660,16 +16660,16 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
|
|
|
16660
16660
|
} else if (modified && !finalEditor.modified) {
|
|
16661
16661
|
dispose$3(uid);
|
|
16662
16662
|
}
|
|
16663
|
-
return finalEditor;
|
|
16663
|
+
return returnState ? finalEditor : undefined;
|
|
16664
16664
|
});
|
|
16665
16665
|
};
|
|
16666
|
-
const wrapFocusCommand = fn => {
|
|
16667
|
-
const command = wrapCommand((editor, widgetRevision) => {
|
|
16666
|
+
const wrapFocusCommand$1 = (fn, returnState = true) => {
|
|
16667
|
+
const command = wrapCommand$1((editor, widgetRevision) => {
|
|
16668
16668
|
if (editor.widgetRevision !== widgetRevision && editor.focus !== FocusEditorText$1) {
|
|
16669
16669
|
return editor;
|
|
16670
16670
|
}
|
|
16671
16671
|
return fn(editor);
|
|
16672
|
-
});
|
|
16672
|
+
}, false, returnState);
|
|
16673
16673
|
return uid => {
|
|
16674
16674
|
// DOM focus events can arrive while a queued command is still opening a widget.
|
|
16675
16675
|
const widgetRevision = get$8(uid)?.newState.widgetRevision;
|
|
@@ -16677,6 +16677,14 @@ const wrapFocusCommand = fn => {
|
|
|
16677
16677
|
};
|
|
16678
16678
|
};
|
|
16679
16679
|
|
|
16680
|
+
// State and undo history belong in this worker. Rendering reads changes separately.
|
|
16681
|
+
const wrapCommand = (fn, preservesTypingCoalescing = false) => {
|
|
16682
|
+
return wrapCommand$1(fn, preservesTypingCoalescing, false);
|
|
16683
|
+
};
|
|
16684
|
+
const wrapFocusCommand = fn => {
|
|
16685
|
+
return wrapFocusCommand$1(fn, false);
|
|
16686
|
+
};
|
|
16687
|
+
|
|
16680
16688
|
const executeViewletCommand = (uid, commandId, ...args) => {
|
|
16681
16689
|
return executeViewletCommand$1(commandMap, uid, commandId, ...args);
|
|
16682
16690
|
};
|