Let an image attachment carry a link
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 119
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 15
Description
Right now when you select an image, open the link dropdown, enter a URL and press Link: nothing happens! `dispatchLink` returns early unless the selection is a range, and a selected attachment is a node selection.
Fortunately Action Text already has a home for this. `href` is in `ActionText::Attachment::ATTRIBUTES` already, because Trix attachments could carry one, so `` survives sanitisation and the round-trip today. Lexxy just never reads or writes it.
### Proposal
Store `href` on `ActionTextAttachmentNode`, have the link and unlink commands set and clear it when the selection is an attachment, and reflect it in the toolbar and the link dropdown. Rendering the anchor stays with the host's blob partial, the same way caption does.
Keeping the link on the node rather than wrapping the attachment in a `LinkNode` matters: a wrapped attachment becomes the child of an inline node, and the node inserter, drag and drop and gallery creation all assume a selected attachment is a top-level block or a gallery child. It also means images inside a gallery can be linked without touching ImageGalleryNode.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with dispatchLink and ActionTextAttachmentNode, then trace the link and unlink commands, toolbar, and link dropdown behavior for attachment selections. Check how href is preserved by Action Text and how the host blob partial renders attachments, without wrapping nodes in LinkNode. Done means image attachments can set and clear href, the toolbar and dropdown reflect it, and gallery attachments continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rails
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100