Skip to content

Commit

Permalink
fix(TheEditor): No sidebar item deactivation - don't blow up
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Dziekoński <[email protected]>
  • Loading branch information
mdziekon committed Sep 14, 2024
1 parent e69b976 commit 52de8fc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
dense
:active="structureActive"
:open="structureOpen"
item-key="line"
:item-key="treeviewItemKeyProp"
:items="configFileStructure"
class="w-100"
@update:active="activeChanges">
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -431,13 +432,18 @@ export default class TheEditor extends Mixins(BaseMixin) {
this.structureActiveChangedBySidebar = true
}
activeChanges(key: any) {
activeChanges(activeItems: Array<ConfigFileSection[typeof this.treeviewItemKeyProp]>) {
if (!this.structureActiveChangedBySidebar) {
return
}
this.structureActiveChangedBySidebar = false
this.editor?.gotoLine(key)
if (!activeItems.length) {
return
}
this.editor?.gotoLine(activeItems[0])
}
lineChanges(line: number) {
Expand Down

0 comments on commit 52de8fc

Please sign in to comment.