Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
don't override section activation if section if open
zadam65c3bcb5652e
diff --git a/src/public/app/widgets/containers/collapsible_section_container.js b/src/public/app/widgets/containers/collapsible_section_container.jsindex 34dcd57e77..92571f5c94 100644--- a/src/public/app/widgets/containers/collapsible_section_container.js+++ b/src/public/app/widgets/containers/collapsible_section_container.js@@ -155,7 +155,7 @@ export default class CollapsibleSectionContainer extends NoteContextAwareWidgetthis.lastActiveComponentId = sectionComponentId;- const activeChild = this.getActiveChild();+ const activeChild = this.getActiveSectionWidget();if (activeChild) {activeChild.handleEvent('noteSwitched', {noteContext: this.noteContext, notePath: this.notePath});@@ -193,7 +193,7 @@ export default class CollapsibleSectionContainer extends NoteContextAwareWidgetthis.$titleContainer.append($sectionTitle);this.$titleContainer.append('<div class="section-title section-title-empty">');- if (ret.activate && !$sectionToActivate && !noExplicitActivation) {+ if (ret.activate && !this.lastActiveComponentId && !$sectionToActivate && !noExplicitActivation) {$sectionToActivate = $sectionTitle;}@@ -226,11 +226,15 @@ export default class CollapsibleSectionContainer extends NoteContextAwareWidgetawait super.handleEventInChildren('setNoteContext', data);}else {- const activeChild = this.getActiveChild();+ const activeSectionWidget = this.getActiveSectionWidget();// forward events only to active section, inactive ones don't need to be updated- if (activeChild) {- await activeChild.handleEvent(name, data);+ if (activeSectionWidget) {+ await activeSectionWidget.handleEvent(name, data);+ }++ for (const buttonWidget of this.buttonWidgets) {+ await buttonWidget.handleEvent(name, data);}}}@@ -245,7 +249,7 @@ export default class CollapsibleSectionContainer extends NoteContextAwareWidget}}- getActiveChild() {- return this.children.find(ch => ch.componentId === this.lastActiveComponentId)+ getActiveSectionWidget() {+ return this.sectionWidgets.find(ch => ch.componentId === this.lastActiveComponentId)}}