Link the margin notes from the notes, and let them be hidden

The linking went the wrong way round. A remark in the margin is short by design;
when there is more to say about that passage it belongs in the notes beside the
document — and it has to be possible to say *which* passage. So the pins are
offered to the editor's `@` menu exactly like notes and notebooks are, labelled
with their page, and following one scrolls the document to the spot and opens the
remark. Pins are unhidden first: a link leading to something invisible would read
as broken.

A pin link is the same node with kind "pin", and is deliberately kept out of the
links reported to the server. Its target is a marker inside this note's own
overlay, so no note has that id, and reporting it would fill the backlink table
with rows matching nothing.

They can also be hidden altogether. Reading a document as it was printed is a
normal thing to want; the toolbar takes the markers and the column away together
and the page takes the width back.

The other direction — making a note out of a remark — is removed, along with its
picker and the pin's noteId: 357 lines fewer than before. The unmount flush it
turned up stays, since a drawing save was genuinely being dropped by navigating
away inside its debounce.

218 unit tests, 231 browser checks across eleven suites.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Opus 5 committed 2026-08-10 20:00:46 +02:00
1 parent 502aecfc92
commit 4c1b632029
13 files changed
+239 -484

No files matched your search

+6 -3
View File
@@ -1,9 +1,12 @@
/**
* Note links — type `@` to reference another note or notebook.
* Note links — type `@` to reference another note, a notebook, or, inside a PDF,
* one of the notes pinned to its pages.
*
* A link is an atomic inline node carrying the target's id, so it survives
* renames: the label is refreshed from the current title on render, and the id
* is what the backlink index is built from.
* is what the backlink index is built from. A `pin` link is deliberately left
* out of that index — its target is a marker in the note's own overlay, so no
* note has that id.
*/
import { Node, mergeAttributes } from "@tiptap/core";
@@ -68,7 +71,7 @@ export const NoteLink = Node.create({
href: "#",
title: node.attrs.label,
}),
`${node.attrs.kind === "notebook" ? "📓" : "📝"} ${node.attrs.label}`,
`${{ notebook: "📓", pin: "📌" }[node.attrs.kind] || "📝"} ${node.attrs.label}`,
];
},