@lvce-editor/editor-worker 18.15.0 → 18.16.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.
- package/dist/editorWorkerMain.js +23 -3
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -9899,16 +9899,35 @@ const unsetAdditionalFocus = async focusKey => {
|
|
|
9899
9899
|
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
9900
9900
|
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
9901
9901
|
};
|
|
9902
|
+
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
9903
|
+
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
9904
|
+
return false;
|
|
9905
|
+
}
|
|
9906
|
+
return oldState.lines !== newState.lines || oldState.tokenizerId !== newState.tokenizerId || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.decorations !== newState.decorations || oldState.embeds !== newState.embeds || oldState.deltaX !== newState.deltaX || oldState.width !== newState.width || oldState.highlightedLine !== newState.highlightedLine || oldState.debugEnabled !== newState.debugEnabled;
|
|
9907
|
+
};
|
|
9902
9908
|
const updateDerivedState = async (oldState, newState) => {
|
|
9909
|
+
let finalState = newState;
|
|
9910
|
+
if (shouldUpdateVisibleTextData(oldState, newState)) {
|
|
9911
|
+
const syncIncremental = getEnabled();
|
|
9912
|
+
const {
|
|
9913
|
+
differences,
|
|
9914
|
+
textInfos
|
|
9915
|
+
} = await getVisible$1(newState, syncIncremental);
|
|
9916
|
+
finalState = {
|
|
9917
|
+
...newState,
|
|
9918
|
+
differences,
|
|
9919
|
+
textInfos
|
|
9920
|
+
};
|
|
9921
|
+
}
|
|
9903
9922
|
if (!shouldUpdateSelectionData(oldState, newState)) {
|
|
9904
|
-
return
|
|
9923
|
+
return finalState;
|
|
9905
9924
|
}
|
|
9906
9925
|
const {
|
|
9907
9926
|
cursorInfos,
|
|
9908
9927
|
selectionInfos
|
|
9909
|
-
} = await getVisible(
|
|
9928
|
+
} = await getVisible(finalState);
|
|
9910
9929
|
return {
|
|
9911
|
-
...
|
|
9930
|
+
...finalState,
|
|
9912
9931
|
cursorInfos,
|
|
9913
9932
|
selectionInfos
|
|
9914
9933
|
};
|
|
@@ -12026,6 +12045,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
12026
12045
|
return newEditor;
|
|
12027
12046
|
}
|
|
12028
12047
|
const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
|
|
12048
|
+
|
|
12029
12049
|
// TODO if editor did not change, no need to update furthur
|
|
12030
12050
|
|
|
12031
12051
|
// TODO combine neweditor with latest editor?
|