feat: j/k scroll the open document, and import loose files

With a document open and not being edited, j/k scroll the reading pane,
gg/G jump to its top and bottom, and Ctrl-D/Ctrl-U page it. h still backs
out to the list, where the same keys walk the rows again.

The import pickers offered a folder or a zip and nothing else, so a single
file could not be imported at all. The second picker now takes any files;
the server already handled them.
This commit is contained in:
nvrl committed 2026-09-20 20:42:20 +02:00
1 parent d8ebf4b850
commit 714a84089a
4 files changed
+77 -13

No files matched your search

+7 -1
View File
@@ -2,6 +2,9 @@ import { api, type BackupStatus } from './api'
import { workspace, type Theme } from './store.svelte'
import { formatDay, parseDay } from './util'
/** How far the reading pane is asked to scroll: lines, a half page, or an end. */
export type ScrollAmount = number | 'top' | 'bottom' | 'halfdown' | 'halfup'
/** Filled in by App.svelte so ex-commands can reach the DOM-bound bits. */
export const hooks = {
pickFiles: () => {},
@@ -10,6 +13,9 @@ export const hooks = {
focusEditor: () => {},
focusList: () => {},
insertText: (_text: string) => {},
/* Filled in while a document is on screen and not being edited: the reading
pane owns the scrollback, so the list keys have somewhere to send it. */
scrollReader: (_amount: ScrollAmount): boolean => false,
openCommandLine: (_initial: string) => {},
}
@@ -210,7 +216,7 @@ export const commands: CommandSpec[] = [
help: 'upload a folder into this one — markdown becomes documents, links follow',
run: () => hooks.pickFolder(),
bang: {
help: 'import a .zip of a folder instead of the folder itself',
help: 'import loose files, or a .zip of a folder, instead of a folder',
run: () => hooks.pickArchive(),
},
},