For content copied from another app, WebKitGTK's navigator.clipboard.read() often
returns nothing, or only text/plain, while Ctrl+V still receives the HTML. The
context menu then pasted plain text and lost bold, links and other formatting.
Whatever the web clipboard leaves out is now filled in from the native clipboard.
The new read_clipboard_contents command (replacing read_clipboard_text) returns
both text and HTML through arboard. The result is replayed through the same paste
handlers as Ctrl+V. That includes the WebKitGTK image fallback for an <img>-only
clipboard. The direct native image read only runs when there is no text or HTML.
Images now keep their CommonMark title as hover text through load, edit and
save: ``. Link titles are still dropped, as
before.
Parsing:
- helix_images no longer strips `title` from images (links unchanged).
- An image whose destination and title are valid CommonMark now uses
markdown-it's own image rule instead of the legacy-link rule. Previously
any space before a title sent the image down the legacy path, which can't
handle escaped quotes (`"Say \"hi\""`) or `(title)` titles and mangled
them into the URL.
- Genuinely legacy forms (spaces in the path, `%20"title"`) still go through
the legacy rule, which now also keeps the image's title.
Saving: `serializeImageTitle()` writes ` "title"` with CommonMark backslash
escapes (`\"`, `\\`, and `\&` only before entity-like text). The parser
undoes these exactly, so titles survive any number of saves unchanged.
UI: a "T" button on the image toolbar opens a small dialog to set or clear
the hover text.
Tests: tests/image-titles.test.mjs covers exact round trips for tricky titles
(parentheses, &, entities, quotes, backslashes, markup), no growth over
repeated saves, the written form, titles from other apps, legacy
destinations, and links still dropping titles. The upstream assertion that
images render without `title=` is updated to the new contract.
Implements #254. Several images can now sit side by side in a grid or masonry
layout with 2 to 4 columns. The syntax is plain Markdown images inside a
`:::` container, so other renderers show the images stacked:
:::img-grid cols=3 masonry


:::
Parsing is a markdown-it block rule (`helix_img_grid` in markdownParser.ts),
not a text pre-pass:
- Grid syntax inside code blocks is never converted, because code blocks
claim those lines first.
- A block converts only if every line is exactly one image (CommonMark image
syntax, so titles, parentheses and <angle> destinations parse as for any
image). Unknown options, out-of-range columns, captions, linked images,
blank lines or a missing closer leave the whole block as ordinary Markdown.
- Each grid image is an ordinary inline image token, so it gets the same
source resolution, `|size=` handling and title policy as other images.
Saving writes the grid as a normal block through joinMarkdownBlocks, with a
blank line before it. The images serialize with the same code as images in
paragraphs, one per line. The header is written in canonical form.
Editor (src/lib/editor/extensions/imageGrid.ts):
- `imageGrid` node (`image+`) whose renderHTML includes data-img-grid, so
copied grids paste back as grids
- header controls: cycle columns, grid/masonry toggle, ungroup
- image toolbar: "Grid" groups the image with neighboring image-only blocks;
arrow buttons move an image left or right inside its grid
- drag-and-drop reorder within and between grids; an emptied grid is removed
- `/image-grid` slash command: multi-file picker that inserts a grid, using
the origin-guarded asset saving
- mobile: 3-4 column grids collapse to 2. Print: compact 2-column rows,
controls hidden
Tests (tests/image-grid.test.mjs) cover byte-identical round trips, sizes,
code-fenced examples, no partial conversion, titles and angle-bracket
destinations, repeated saves, trailing closers, nesting, reloading next to
other blocks, renderHTML/parseHTML agreement, grouping and reorder targets.
On Linux, the context-menu Paste used its own navigator.clipboard.readText()
flow. On WebKitGTK it lost text copied from other applications. When a web
image copy also carried text, it pasted the URL instead of the bitmap. It
also skipped ProseMirror's paste handling, so things like callout paste and
the pasted-HTML style cleanup never ran.
The context menu now reads the clipboard with navigator.clipboard.read(),
classifies each format, and replays the result as a paste event on the
editor DOM. That runs the same path as Ctrl/Cmd+V: ProseMirror's paste
handler, every handlePaste prop (file, callout, link), transformPastedHTML,
the clipboard parsers and TipTap's paste rules.
Only real attachments (image/*, application/pdf) become files. Other text
formats such as text/uri-list stay text, and browser/OS metadata formats are
ignored, so a copied link no longer becomes a pasted-0.uri-list attachment.
A link offered only as a URI list pastes as its first URI.
When the web clipboard is unavailable (WebKitGTK bug #218519), Paste falls
back to native arboard reads: the image first, then text through the new
read_clipboard_text command. The text is replayed through the same paste
path. Every await re-checks the editor origin, as upstream's paste code does.
The classification lives in src/lib/utils/clipboard-paste.ts and has
regression tests.
Closes#259