From fc749b7375af33a1c7cf8d4323e2f220164917d9 Mon Sep 17 00:00:00 2001 From: parisma Date: Tue, 13 Sep 2022 17:22:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(editor):=20codeBlockService.getCodeDsl?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=88=B7=E6=96=B0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/services/codeBlock.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/services/codeBlock.ts b/packages/editor/src/services/codeBlock.ts index e4ad41fe..2b4bcdba 100644 --- a/packages/editor/src/services/codeBlock.ts +++ b/packages/editor/src/services/codeBlock.ts @@ -70,10 +70,11 @@ class CodeBlock extends BaseService { /** * 获取活动的代码块dsl数据源(默认从dsl中的methods字段读取) + * @param {boolean} forceRefresh 是否强制从活动dsl拉取刷新 * @returns {CodeBlockDSL | null} */ - public async getCodeDsl(): Promise { - if (!this.state.codeDsl) { + public async getCodeDsl(forceRefresh = false): Promise { + if (!this.state.codeDsl || forceRefresh) { this.state.codeDsl = await editorService.getCodeDsl(); } return this.state.codeDsl; @@ -288,6 +289,12 @@ class CodeBlock extends BaseService { public destroy() { this.state.isShowCodeEditor = false; this.state.codeDsl = null; + this.state.id = ''; + this.state.editable = true; + this.state.mode = EditorMode.EDITOR; + this.state.combineIds = []; + this.state.compRelation = {}; + this.state.undeletableList = []; } }