chore: 插件编辑与运行测试beta

This commit is contained in:
xiaojunnuo
2025-04-08 22:56:38 +08:00
parent c021dd03d3
commit a0eeb17d73
17 changed files with 169 additions and 122 deletions
@@ -26,7 +26,6 @@ export function registerWorker(name: string, worker: any) {
window.MonacoEnvironment = {
//@ts-ignore
getWorker(_, label) {
debugger;
const custom = WorkerBucket[label];
if (custom) {
return new custom();
@@ -83,17 +83,6 @@ const emitValue = lodashDebounce((value: any) => {
emits("update:modelValue", value);
}, props.debounce || 500);
// watch(
// () => {
// return props.modelValue;
// },
// (value: string) => {
// if (instanceRef.value && value !== instanceRef.value.getValue()) {
// // instanceRef.value.setValue(value);
// }
// }
// );
async function createEditor(ctx: EditorCodeCtx) {
disposeEditor();
const instance = monaco.editor.create(monacoRef.value, {
@@ -121,6 +110,9 @@ async function createEditor(ctx: EditorCodeCtx) {
instanceRef = instance;
ctx.instance = instance;
emits("ready", ctx);
if (props.modelValue) {
instanceRef.setValue(props.modelValue);
}
return instance;
}
@@ -224,6 +216,9 @@ watch(
editor.setValue(newValue);
}
}
},
{
immediate: true,
}
);
@@ -49,7 +49,6 @@ export async function initWorkers() {
} else if (label === "typescript" || label === "javascript") {
return new tsWorker.default();
} else if (label === "yaml" || label === "yml") {
debugger;
//@ts-ignore
return new yamlWorker.default();
}