Open a note that also links as its article with the note on top

Words carrying a note and a Wikipedia link (one note with a body and a
target, as the bulk linking pass made by merging links onto glosses, or a
note and a link on the same words) opened only the note: a click toggled
the gloss inline in both views, Enter did the same in the column, and in
panes Enter opened the note's pane with the article folded to its summary.

Now Enter or a click opens one page: the note's text first, then the
article in full (in the column the note is hoisted and h returns to its
words; in panes it is the next pane). A note's target is its own or that of
a link on exactly its words. Node and web targets show their card beneath
the note the same way. Browser tests cover click and keyboard in both views
and the same-span case; the old test only covered the folded panes path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-15 21:10:19 -05:00
1 parent f86a06fa06
commit 02e044af35
11 files changed
+187 -57

No files matched your search

+3 -3
View File
@@ -21,7 +21,7 @@ export const HELP: [string, [string, string][]][] = [
"Links",
[
["", "W marks a Wikipedia link, § another note in the library, ↗ a web page; a dotted underline is a note, both together a note that also links"],
["Enter", "on a link: open it (panes: the next pane; column: a preview, Enter again opens it)"],
["Enter", "on a link: open it (panes: the next pane; column: a preview, Enter again opens it). On a note that also links, or a note and a link on the same words: one page, the note's text above the article"],
["w", "on a selection: link it (library, Wikipedia or an address); on a link: retarget it; on a node: give the node a target"],
["L", "on a node: open its own target"],
["W", "open the focused article on wikipedia.org, in a new tab"],
@@ -379,7 +379,7 @@ export function handleKey(e: KeyboardEvent, hooks: KeyHooks) {
case "Enter":
case " ":
if (selecting) store.enterOrExpand();
else if (store.snap.nodes[store.focus.node]?.kind === "note" && store.snap.nodes[store.focus.node].ref) store.followOwn();
else if (store.snap.nodes[store.focus.node]?.kind === "note" && store.targetOf(store.focus.node)) store.followOwn();
else store.toggle();
break;
case "w":
@@ -540,7 +540,7 @@ function auxKey(k: string, shift: boolean): boolean {
// Under a node, its article opens in a pane of its own.
const a = store.aux;
const id = a?.kind === "wiki" && a.host.startsWith("n") ? a.host.slice(1) : a?.kind === "target" ? a.of : null;
const r = id ? store.snap.nodes[id as keyof typeof store.snap.nodes]?.ref : undefined;
const r = id ? store.targetOf(id as keyof typeof store.snap.nodes) : undefined;
if (r) store.follow(r);
return true;
}