penpot/frontend
Filip Sajdak 454e461c1e
✨ Copy stable deep link to selected boards from context menu (#10170)
* ✨ Copy stable deep link to selected boards from context menu

The workspace "Copy link" action copied the raw current location, which
only carries file and page ids, so the link did not point at any specific
board. Build the link from the current route plus a `board-id` query param
derived from the selection: a selected board contributes its own id, and a
selected shape contributes the id of the board it belongs to.

`board-id` is an existing workspace route param (`zoom-to-frame` already
selects and zooms to it on load), and board ids are stable across renames
and reordering, so the link keeps resolving to the same board. When the
selection contains no board, it falls back to the previous behavior.

Relates to #4584

AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>

* 📎 Add tests for copying a stable board link

copy-link-to-clipboard now links to the boards of the selection through
their ids, and nothing covered it. The tests run the event on a state
with two boards, a rectangle in each and a rectangle on the root, with
the router and the clipboard replaced.

They check that a selected board, and a shape in a board, link to that
board; that shapes in two boards link to both and a board with its child
gives one id; that the route params are kept next to the board ids; and
that an empty selection, or a shape on the root, copies the current
location. The five board cases fail on the version of the function before
the change.

AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>

* ♻️ Share how the selection maps to its boards

select-shape and copy-link-to-clipboard each worked out which boards
a selection belongs to, with slightly different rules for a shape on
the root. Both now call selected-board-ids.

A selection with a shape on the root has no board to point at, so the
URL and the copied link both leave out the board ids. Before, the
copied link kept the boards of the rest of the selection. The URL also
lists each board once now, and has no board-id for an empty selection.

AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>

---------

Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
Co-authored-by: Eva Marco <eva.marco@kaleidos.net>
2026-11-20 09:47:11 +01:00
..
2026-10-07 10:41:29 +02:00