Fix home/end to account for special pages
This commit is contained in:
parent
f5cbfb0b22
commit
1a712fb7a9
1 changed files with 11 additions and 10 deletions
|
|
@ -248,8 +248,6 @@ export class N2Sidebar extends CustomHTMLElement {
|
||||||
// Holding shift down does it recursively.
|
// Holding shift down does it recursively.
|
||||||
case Space:
|
case Space:
|
||||||
case 'Enter':
|
case 'Enter':
|
||||||
if (n.UUID === ROOT_NODE)
|
|
||||||
return
|
|
||||||
const expanded = this.getNodeExpanded(n.UUID)
|
const expanded = this.getNodeExpanded(n.UUID)
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
this.recursiveExpand(n, !expanded)
|
this.recursiveExpand(n, !expanded)
|
||||||
|
|
@ -404,23 +402,26 @@ export class N2Sidebar extends CustomHTMLElement {
|
||||||
}//}}}
|
}//}}}
|
||||||
async navigateTop() {//{{{
|
async navigateTop() {//{{{
|
||||||
const root = await nodeStore.get(ROOT_NODE)
|
const root = await nodeStore.get(ROOT_NODE)
|
||||||
if (root.Children.length === 0)
|
_mbus.dispatch("GO_TO_NODE", { nodeUUID: root.UUID, dontPush: false, dontExpand: true })
|
||||||
return
|
|
||||||
_mbus.dispatch("GO_TO_NODE", { nodeUUID: root.Children[0]?.UUID, dontPush: false, dontExpand: true })
|
|
||||||
}//}}}
|
}//}}}
|
||||||
async navigateBottom() {//{{{
|
async navigateBottom() {//{{{
|
||||||
const root = await nodeStore.get(ROOT_NODE)
|
const orphaned = await nodeStore.get(ORPHANED_NODE)
|
||||||
if (root.Children.length === 0)
|
|
||||||
return
|
|
||||||
|
|
||||||
const toplevel = root.Children[root.Children.length - 1]
|
if (!orphaned.hasChildren() || this.getNodeExpanded(orphaned.UUID)) {
|
||||||
|
_mbus.dispatch("GO_TO_NODE", { nodeUUID: orphaned.UUID, dontPush: false, dontExpand: true })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO - fix this when orphaned nodes are implemented.
|
||||||
|
const toplevel = orphaned.Children[orphaned.Children.length - 1]
|
||||||
const toplevelExpanded = this.getNodeExpanded(toplevel?.UUID)
|
const toplevelExpanded = this.getNodeExpanded(toplevel?.UUID)
|
||||||
|
|
||||||
if (toplevelExpanded) {
|
if (toplevelExpanded) {
|
||||||
const lastnode = this.getLastExpandedNode(toplevel)
|
const lastnode = this.getLastExpandedNode(toplevel)
|
||||||
_mbus.dispatch("GO_TO_NODE", { nodeUUID: lastnode?.UUID, dontPush: false, dontExpand: true })
|
_mbus.dispatch("GO_TO_NODE", { nodeUUID: lastnode?.UUID, dontPush: false, dontExpand: true })
|
||||||
} else
|
} else
|
||||||
_mbus.dispatch("GO_TO_NODE", { nodeUUID: root.Children[root.Children.length - 1]?.UUID, dontPush: false, dontExpand: true })
|
_mbus.dispatch("GO_TO_NODE", { nodeUUID: orphaned.Children[orphaned.Children.length - 1]?.UUID, dontPush: false, dontExpand: true })
|
||||||
|
*/
|
||||||
}//}}}
|
}//}}}
|
||||||
|
|
||||||
getParentWithNextSibling(node) {//{{{
|
getParentWithNextSibling(node) {//{{{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue