From 4e6189249dbba95a2e7e66f9a2af26e2f169da16 Mon Sep 17 00:00:00 2001 From: Rupato Braganza Date: Wed, 11 Dec 2024 11:18:50 +0800 Subject: [PATCH] fix: error not in the document --- src/stores/load-modal-store.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/stores/load-modal-store.ts b/src/stores/load-modal-store.ts index d3bfb41c..284e551f 100644 --- a/src/stores/load-modal-store.ts +++ b/src/stores/load-modal-store.ts @@ -511,16 +511,17 @@ export default class LoadModalStore { this.setSelectedStrategyId(workspace_id); await waitForDomElement('#load-strategy__blockly-container'); - const ref_preview = document?.getElementById('load-strategy__blockly-container'); - - if (!this.recent_workspace) this.recent_workspace = window.Blockly.inject(ref_preview, inject_options); - (this.recent_workspace as any).RTL = isDbotRTL(); + const ref_preview = document.getElementById('load-strategy__blockly-container'); - const convertedDom = window.Blockly?.utils?.xml?.textToDom(this.selected_strategy?.xml); - const mainWorkspace = window.Blockly?.getMainWorkspace(); + if (ref_preview) { + if (!this.recent_workspace) this.recent_workspace = window.Blockly.inject(ref_preview, inject_options); + (this.recent_workspace as any).RTL = isDbotRTL(); - window.Blockly?.Xml?.clearWorkspaceAndLoadFromXml(convertedDom, mainWorkspace); + const convertedDom = window.Blockly?.utils?.xml?.textToDom(this.selected_strategy?.xml); + const mainWorkspace = window.Blockly?.getMainWorkspace(); + window.Blockly?.Xml?.clearWorkspaceAndLoadFromXml(convertedDom, mainWorkspace); + } setLoading(false); this.setOpenButtonDisabled(false); };