From 47b19ae7fa43fb03608e8f7380b8c69cd50d68f0 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Thu, 28 Mar 2024 21:02:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(playground):=20=E7=BC=93=E5=AD=98=E4=B8=8A?= =?UTF-8?q?=E6=AC=A1=E4=BF=9D=E5=AD=98dsl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/src/pages/Editor.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/playground/src/pages/Editor.vue b/playground/src/pages/Editor.vue index f5420adc..d2f0565a 100644 --- a/playground/src/pages/Editor.vue +++ b/playground/src/pages/Editor.vue @@ -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) => {