@lvce-editor/editor-worker 19.26.3 → 19.27.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 +74 -0
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4693,6 +4693,76 @@ const createEditor = async ({
|
|
|
4693
4693
|
});
|
|
4694
4694
|
};
|
|
4695
4695
|
|
|
4696
|
+
const createStandaloneEditor = async ({
|
|
4697
|
+
assetDir,
|
|
4698
|
+
charWidth,
|
|
4699
|
+
content,
|
|
4700
|
+
fontFamily,
|
|
4701
|
+
fontSize,
|
|
4702
|
+
fontWeight,
|
|
4703
|
+
height,
|
|
4704
|
+
id,
|
|
4705
|
+
languageId,
|
|
4706
|
+
letterSpacing,
|
|
4707
|
+
lineNumbers,
|
|
4708
|
+
platform,
|
|
4709
|
+
rowHeight,
|
|
4710
|
+
tabSize,
|
|
4711
|
+
tokenizePath,
|
|
4712
|
+
uri,
|
|
4713
|
+
width,
|
|
4714
|
+
x,
|
|
4715
|
+
y
|
|
4716
|
+
}) => {
|
|
4717
|
+
createEditor2(id, uri, x, y, width, height, platform, assetDir);
|
|
4718
|
+
const createdEditor = get$7(id).newState;
|
|
4719
|
+
await loadTokenizer(languageId, tokenizePath);
|
|
4720
|
+
const tokenizerId = createdEditor.tokenizerId + 1;
|
|
4721
|
+
set$4(tokenizerId, getTokenizer(languageId));
|
|
4722
|
+
const configuredEditor = {
|
|
4723
|
+
...createdEditor,
|
|
4724
|
+
charWidth,
|
|
4725
|
+
columnWidth: charWidth,
|
|
4726
|
+
completionsOnType: false,
|
|
4727
|
+
focus: FocusEditorText$1,
|
|
4728
|
+
focused: true,
|
|
4729
|
+
fontFamily,
|
|
4730
|
+
fontSize,
|
|
4731
|
+
fontWeight,
|
|
4732
|
+
initial: false,
|
|
4733
|
+
isMonospaceFont: true,
|
|
4734
|
+
itemHeight: rowHeight,
|
|
4735
|
+
languageId,
|
|
4736
|
+
letterSpacing,
|
|
4737
|
+
lineNumbers,
|
|
4738
|
+
rowHeight,
|
|
4739
|
+
selections: new Uint32Array([0, 0, 0, 0]),
|
|
4740
|
+
tabSize,
|
|
4741
|
+
tokenizerId
|
|
4742
|
+
};
|
|
4743
|
+
const boundedEditor = setBounds(configuredEditor, x, y, width, height, charWidth);
|
|
4744
|
+
const editorWithText = setText$1(boundedEditor, content);
|
|
4745
|
+
const {
|
|
4746
|
+
differences,
|
|
4747
|
+
textInfos
|
|
4748
|
+
} = await getVisible$1(editorWithText, true);
|
|
4749
|
+
const editorWithVisibleText = {
|
|
4750
|
+
...editorWithText,
|
|
4751
|
+
differences,
|
|
4752
|
+
textInfos
|
|
4753
|
+
};
|
|
4754
|
+
const {
|
|
4755
|
+
cursorInfos,
|
|
4756
|
+
selectionInfos
|
|
4757
|
+
} = await getVisible(editorWithVisibleText);
|
|
4758
|
+
const finalEditor = {
|
|
4759
|
+
...editorWithVisibleText,
|
|
4760
|
+
cursorInfos,
|
|
4761
|
+
selectionInfos
|
|
4762
|
+
};
|
|
4763
|
+
set$9(id, createdEditor, finalEditor);
|
|
4764
|
+
};
|
|
4765
|
+
|
|
4696
4766
|
const isEqual$4 = (oldState, newState) => {
|
|
4697
4767
|
return oldState.additionalFocus === newState.additionalFocus;
|
|
4698
4768
|
};
|
|
@@ -11571,6 +11641,9 @@ const getProblems = async () => {
|
|
|
11571
11641
|
const diagnostics = keys.flatMap(key => {
|
|
11572
11642
|
const numericKey = Number(key);
|
|
11573
11643
|
const editor = get$7(numericKey);
|
|
11644
|
+
if (!editor?.newState) {
|
|
11645
|
+
return [];
|
|
11646
|
+
}
|
|
11574
11647
|
return editor.newState.diagnostics;
|
|
11575
11648
|
});
|
|
11576
11649
|
return diagnostics;
|
|
@@ -13417,6 +13490,7 @@ const commandMap = {
|
|
|
13417
13490
|
'Editor.copyLineUp': wrapCommand(copyLineUp),
|
|
13418
13491
|
'Editor.create': createEditor,
|
|
13419
13492
|
'Editor.create2': createEditor2,
|
|
13493
|
+
'Editor.createStandalone': createStandaloneEditor,
|
|
13420
13494
|
'Editor.cursorCharacterLeft': wrapCommand(cursorCharacterLeft),
|
|
13421
13495
|
'Editor.cursorCharacterRight': wrapCommand(cursorCharacterRight),
|
|
13422
13496
|
'Editor.cursorDocumentEnd': wrapCommand(cursorDocumentEnd),
|