feat(playground): 缓存上次保存dsl

This commit is contained in:
roymondchen 2024-03-28 21:02:15 +08:00
parent edfe5c6973
commit 47b19ae7fa

View File

@ -224,7 +224,18 @@ asyncLoadJs(`${VITE_ENTRY_PATH}/ds-value/index.umd.cjs`).then(() => {
datasourceValues.value = (globalThis as any).magicPresetDsValues;
});
save();
try {
// eslint-disable-next-line no-eval
const magicDSL = eval(`(${localStorage.getItem('magicDSL')})`);
if (!magicDSL) {
save();
} else {
value.value = magicDSL;
}
} catch (e) {
console.error(e);
save();
}
editorService.usePlugin({
beforeDoAdd: (config: MNode, parent: MContainer) => {