Add a quick "Navigate: Home" command with Alt-h keyboard shortcut

pull/3/head
Zef Hemel 2022-07-04 11:52:09 +02:00
parent 5c6a49d62a
commit 21836ca073
3 changed files with 20 additions and 5 deletions

View File

@ -36,6 +36,12 @@ functions:
reindexSpace: reindexSpace:
path: "./page.ts:reindexSpace" path: "./page.ts:reindexSpace"
env: server env: server
deletePage:
path: "./page.ts:deletePage"
command:
name: "Page: Delete"
# Backlinks
indexLinks: indexLinks:
path: "./page.ts:indexLinks" path: "./page.ts:indexLinks"
events: events:
@ -44,20 +50,19 @@ functions:
path: ./page.ts:linkQueryProvider path: ./page.ts:linkQueryProvider
events: events:
- query:link - query:link
deletePage:
path: "./page.ts:deletePage"
command:
name: "Page: Delete"
renamePage: renamePage:
path: "./page.ts:renamePage" path: "./page.ts:renamePage"
command: command:
name: "Page: Rename" name: "Page: Rename"
mac: Cmd-Alt-r mac: Cmd-Alt-r
key: Ctrl-Alt-r key: Ctrl-Alt-r
pageComplete: pageComplete:
path: "./page.ts:pageComplete" path: "./page.ts:pageComplete"
events: events:
- page:complete - page:complete
# Navigation
linkNavigate: linkNavigate:
path: "./navigate.ts:linkNavigate" path: "./navigate.ts:linkNavigate"
command: command:
@ -68,6 +73,12 @@ functions:
path: "./navigate.ts:clickNavigate" path: "./navigate.ts:clickNavigate"
events: events:
- page:click - page:click
navigateHome:
path: "./navigate.ts:navigateCommand"
command:
name: "Navigate: Home"
key: "Alt-h"
page: "index"
# Hashtags # Hashtags
indexTags: indexTags:

View File

@ -47,3 +47,7 @@ export async function clickNavigate(event: ClickEvent) {
let newNode = nodeAtPos(mdTree, event.pos); let newNode = nodeAtPos(mdTree, event.pos);
await actionClickOrActionEnter(newNode); await actionClickOrActionEnter(newNode);
} }
export async function navigateCommand(cmdDef: any) {
await navigateTo(cmdDef.page);
}

View File

@ -44,7 +44,7 @@ export class CommandHook
this.editorCommands.set(cmd.name, { this.editorCommands.set(cmd.name, {
command: cmd, command: cmd,
run: () => { run: () => {
return plug.invoke(name, []); return plug.invoke(name, [cmd]);
}, },
}); });
} }