Let a margin remark become a note, and lead to it ever after

Some remarks turn into a page of their own. "Notiz anlegen" on a margin card
makes one, titles it from what was written, and goes there; the pin keeps its id
so the passage leads to that note afterwards. The note is created with a link
back to the document, so the connection reads both ways and the document lists it
among its backlinks — a note born from a passage should not be a note with
nothing on it saying which passage. An existing note can be linked instead, and a
link can be let go of without touching the note. Both are offered on the phone
sheet too.

Two older bugs stood in the way and are fixed:

`openLinkTarget` finds a note's notebook by looking it up in the notes list, and
a note created in the same tick is not in the copy that callback closed over — so
jumping to a fresh note went nowhere at all. Creating one now navigates by the
notebook it already knows.

A drawing save waits 700ms for the next stroke, and leaving the document inside
that window dropped it. That is precisely what turning a remark into a note does,
so the link would have been lost on the way out. The viewer flushes a pending
write when it unmounts, which also covers drawing and navigating away quickly.

215 unit tests, 229 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 16:40:38 +02:00
1 parent 011ba82a94
commit 502aecfc92
10 files changed
+541 -12

No files matched your search

+20 -1
View File
@@ -332,7 +332,7 @@ docker compose -f docker-compose.dev.yml up -d --build # must be running
| `search-attachments` | 12 | body-only matches, ranking, umlauts; images as blob URLs, not inline bytes |
| `history` | 10 | a large deletion is snapshotted, restoring works, restoring is itself undoable |
| `drawing` | 7 | strokes survive the poller, and match across four viewport widths |
| `pdf` | 70 | import, page proportions, lazy loading, and reading with the network off |
| `pdf` | 80 | import, page proportions, lazy loading, and reading with the network off |
| `attachments-lifecycle` | 10 | a picture is kept while any version shows it, and freed once none does |
| `conflict` | 10 | a late write wins but the state it buries survives as a version |
| `export` | 21 | the downloaded bytes are real Markdown, ZIP and PNG, unpacked and read back |
@@ -795,6 +795,25 @@ handling rather than assuming:
notes was therefore stored as `NULL` — every note on it lost on the next save.
Both now ask about strokes *and* pins.
**A remark can become a note of its own.** "Notiz anlegen" on a card makes one,
titles it from what was written, and goes there; the pin keeps its id, so the
passage leads to that note ever after. The note is created with a link back to
the document, so the connection reads in both directions and the document lists
it among its backlinks — a note born from a passage should not be a note with
nothing on it saying which passage. An existing note can be linked instead, and a
link can be let go of without touching the note.
Two things had to be fixed for that to work at all, both of them older than the
feature:
- `openLinkTarget` finds a note's notebook by looking it up in the notes list,
and a note created in the same tick is not in the copy that callback closed
over — so jumping to it went nowhere. Creating one now navigates by the
notebook it already knows.
- A drawing save waits 700ms for the next stroke. Leaving the document inside
that window dropped it, which is exactly what turning a remark into a note
does. The viewer now flushes a pending write when it unmounts.
They come along when the document is exported with annotations: each becomes a
numbered marker plus a small box with its text, placed on whichever side of the
pin has room. Only Latin-1 survives — the standard PDF fonts cannot encode more,