From 253b75a171714618be910e74fca6c335a0f339bb Mon Sep 17 00:00:00 2001 From: salexdv Date: Thu, 25 Aug 2022 14:42:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=20=D0=B4?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B2=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor.js | 10 ++++++++-- src/tree/tree.js | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/editor.js b/src/editor.js index d814029..70716a7 100644 --- a/src/editor.js +++ b/src/editor.js @@ -36,6 +36,7 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit events_queue = []; editor_options = []; snippets = {}; + treeview = null; // #endregion // #region public API @@ -1420,12 +1421,15 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit showVariablesDescription = function(variablesJSON) { try { - - showVariablesDisplay(); + + if (treeview != null) + hideVariablesDisplay(); const variables = JSON.parse(variablesJSON); treeview = new Treeview("#variables-tree", editor, "./tree/icons/"); treeview.replaceData(variables); + showVariablesDisplay(); + return true; } @@ -3118,6 +3122,8 @@ define(['bslGlobals', 'bslMetadata', 'snippets', 'bsl_language', 'vs/editor/edit let element = document.getElementById("display"); element.style.height = "0"; element.style.display = "none"; + treeview.dispose(); + treeview = null; } diff --git a/src/tree/tree.js b/src/tree/tree.js index 905ce2f..be241bb 100644 --- a/src/tree/tree.js +++ b/src/tree/tree.js @@ -104,5 +104,8 @@ class Treeview { this.open(id); document.getElementById(id).focus(); document.getElementById(id).click(); - } + }; + dispose() { + document.querySelector(this.treeviewId).innerHTML = ''; + }; } \ No newline at end of file