Fix quick navigation having reexpanding nodes
This commit is contained in:
parent
4976a6ebe0
commit
697576cb34
2 changed files with 7 additions and 6 deletions
|
|
@ -195,8 +195,7 @@ export class App {
|
||||||
// This is a bad idea when quickly navigating the tree, since the arrow navigation
|
// This is a bad idea when quickly navigating the tree, since the arrow navigation
|
||||||
// has collapsed nodes which the event calling goToNode can come to undo, if the
|
// has collapsed nodes which the event calling goToNode can come to undo, if the
|
||||||
// event processing lags behind.
|
// event processing lags behind.
|
||||||
if (!dontExpand)
|
await this.sidebar.makeVisible(node, ancestors, dontExpand)
|
||||||
await this.sidebar.makeVisible(node, ancestors)
|
|
||||||
|
|
||||||
_mbus.dispatch('CRUMBS_SET', ancestors, () => this.crumbsElement.replaceChildren(this.crumbs.render()))
|
_mbus.dispatch('CRUMBS_SET', ancestors, () => this.crumbsElement.replaceChildren(this.crumbs.render()))
|
||||||
_mbus.dispatch('NODE_UI_OPEN', { node, eventSequence: this.showNodeEventSequence.next() })
|
_mbus.dispatch('NODE_UI_OPEN', { node, eventSequence: this.showNodeEventSequence.next() })
|
||||||
|
|
|
||||||
|
|
@ -429,12 +429,14 @@ export class N2Sidebar extends CustomHTMLElement {
|
||||||
if (!state)
|
if (!state)
|
||||||
await this.setNodeExpanded(node, false)
|
await this.setNodeExpanded(node, false)
|
||||||
}//}}}
|
}//}}}
|
||||||
async makeVisible(node, providedAncestors) {// {{{
|
async makeVisible(node, providedAncestors, dontExpand) {// {{{
|
||||||
const treenode = this.treeNodeComponents[node.UUID]
|
const treenode = this.treeNodeComponents[node.UUID]
|
||||||
|
|
||||||
const ancestors = providedAncestors || await nodeStore.getNodeAncestry(node)
|
if (!dontExpand) {
|
||||||
for (const ancestor of ancestors.reverse()) {
|
const ancestors = providedAncestors || await nodeStore.getNodeAncestry(node)
|
||||||
this.setNodeExpanded(ancestor, true)
|
for (const ancestor of ancestors.reverse()) {
|
||||||
|
this.setNodeExpanded(ancestor, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
treenode?.scrollIntoView({ block: 'nearest' })
|
treenode?.scrollIntoView({ block: 'nearest' })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue