From 52de8fca3ae9660441f27e9ce78f8ad2d06082c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sat, 14 Sep 2024 03:40:21 +0200 Subject: [PATCH] fix(TheEditor): No sidebar item deactivation - don't blow up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Dziekoński --- src/components/TheEditor.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index a49450fca..dce57ec45 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -67,7 +67,7 @@ dense :active="structureActive" :open="structureOpen" - item-key="line" + :item-key="treeviewItemKeyProp" :items="configFileStructure" class="w-100" @update:active="activeChanges"> @@ -189,6 +189,7 @@ export default class TheEditor extends Mixins(BaseMixin) { dialogConfirmChange = false dialogDevices = false fileStructureSidebar = true + treeviewItemKeyProp = 'line' as const structureActive: number[] = [] structureOpen: number[] = [] structureActiveChangedBySidebar: boolean = false @@ -431,13 +432,18 @@ export default class TheEditor extends Mixins(BaseMixin) { this.structureActiveChangedBySidebar = true } - activeChanges(key: any) { + activeChanges(activeItems: Array) { if (!this.structureActiveChangedBySidebar) { return } this.structureActiveChangedBySidebar = false - this.editor?.gotoLine(key) + + if (!activeItems.length) { + return + } + + this.editor?.gotoLine(activeItems[0]) } lineChanges(line: number) {