navigation: the list by name outside the diary, Ctrl-P goes to anything by its name, new things land beside what they belong to

The list is folders first and then by name in every space but the diary,
which stays a journal by day; a document's row elsewhere shows when it
was last edited. Ctrl-P is a jump by name across every space, served by
GET /api/jump: the last word is looked for in the name, the ones before
along the path. / is the one full-text search, and Tab on its line takes
it to every space and back. A card's notes are made in the folder being
browsed when that is in the card's space, and a missing [[link]]'s
document beside the one linking to it. o in a space with templates opens
the line as :new with them listed.
This commit is contained in:
nvrl committed 2026-10-22 17:39:24 +02:00
1 parent c70bfdd7be
commit 9363a0024d
21 files changed
+297 -96

No files matched your search

+17 -3
View File
@@ -44,8 +44,8 @@ export const hooks = {
overviewColumns: (): number => 1,
openOverview: () => {},
openCommandLine: (_initial: string) => {},
/** Ctrl-P: a search across every space. */
openGlobalSearch: () => {},
/** Ctrl-P: a jump to a node by its name, in every space. */
openJump: () => {},
/** Esc with the line open but the keyboard elsewhere: the line away; false when it is not open. */
closeCommandLine: (): boolean => false,
/** `F`: letters over the links and buttons inside `root`. */
@@ -271,6 +271,20 @@ function templateNames(): string[] {
return templateCache.names
}
/**
* `o`: a new document here. When the space has templates the line comes up
* as `:new ` with them listed — Tab picks one, Enter on nothing is a blank
* document. The diary starts from `templates/day` by itself, so it is not
* asked.
*/
export async function newDocument() {
const space = workspace.tree.space
const templates = space && space.role !== 'diary' ? await api.templates(space.id) : []
if (!space || templates.length === 0) return runCommand('new')
templateCache = { space: space.id, names: templates.map((t) => t.slug) }
hooks.openCommandLine(':new ')
}
/** `:encrypt` and `:decrypt`: a file, or everything under a folder. */
const sealTarget = (encrypt: boolean) =>
workspace.guard(async () => {
@@ -1184,7 +1198,7 @@ export const commands: CommandSpec[] = [
help: 'full-text search in this space (empty clears)',
run: (arg) => workspace.guard(() => workspace.tree.search(arg, false)),
bang: {
help: 'full-text search across every space — Ctrl-P',
help: 'full-text search across every space — `/` then Tab',
run: (arg) => workspace.guard(() => workspace.tree.search(arg, true)),
},
},