test
Some checks failed
test / Run tests (push) Failing after 13s
build / Build (push) Failing after 21s
Some checks failed
test / Run tests (push) Failing after 13s
build / Build (push) Failing after 21s
This commit is contained in:
parent
0a025f1b50
commit
c8a8d136c8
@ -175,6 +175,7 @@ function ScriptEditor() {
|
|||||||
visible[key] = show;
|
visible[key] = show;
|
||||||
setVisible({ ...visible });
|
setVisible({ ...visible });
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = (script: Script, e: editor.IStandaloneCodeEditor): Promise<Script> => {
|
const save = (script: Script, e: editor.IStandaloneCodeEditor): Promise<Script> => {
|
||||||
// 解析code生成新的script并更新
|
// 解析code生成新的script并更新
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@ -369,27 +370,42 @@ function ScriptEditor() {
|
|||||||
if (uuid) {
|
if (uuid) {
|
||||||
for (let i = 0; i < scripts.length; i += 1) {
|
for (let i = 0; i < scripts.length; i += 1) {
|
||||||
if (scripts[i].uuid === uuid) {
|
if (scripts[i].uuid === uuid) {
|
||||||
const code = await scriptCodeDAO.findByUUID(uuid);
|
// 如果已经打开则激活
|
||||||
editors.push({
|
scriptCodeDAO.findByUUID(uuid).then((code) => {
|
||||||
|
setEditors((prev) => {
|
||||||
|
const flag = prev.some((item) => item.script.uuid === scripts[i].uuid);
|
||||||
|
if (flag) {
|
||||||
|
return prev.map((item) => {
|
||||||
|
if (item.script.uuid === scripts[i].uuid) {
|
||||||
|
item.active = true;
|
||||||
|
item.code = code!.code;
|
||||||
|
} else {
|
||||||
|
item.active = false;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
prev.push({
|
||||||
script: scripts[i],
|
script: scripts[i],
|
||||||
code: code!.code,
|
code: code!.code,
|
||||||
active: true,
|
active: true,
|
||||||
hotKeys,
|
hotKeys,
|
||||||
isChanged: false,
|
isChanged: false,
|
||||||
});
|
});
|
||||||
|
return prev;
|
||||||
|
});
|
||||||
setSelectSciptButtonAndTab(scripts[i].uuid);
|
setSelectSciptButtonAndTab(scripts[i].uuid);
|
||||||
setEditors([...editors]);
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
});
|
|
||||||
if (!uuid) {
|
|
||||||
emptyScript(template || "", hotKeys, target).then((e) => {
|
emptyScript(template || "", hotKeys, target).then((e) => {
|
||||||
editors.push(e);
|
editors.push(e);
|
||||||
setEditors([...editors]);
|
setEditors([...editors]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 控制onbeforeunload
|
// 控制onbeforeunload
|
||||||
|
Loading…
x
Reference in New Issue
Block a user