Repository navigation
Open
Description
Summary
A strict code-quality review of the #242 / #174 link UI work found 22 structural items. On 2026-11-03 the maintainer chose the risk-reducing and no-risk ones, and they are committed on local main (ceb853258..be63d2138, not pushed yet). The items below are the rest. They keep behaviour the same and make later changes easier. None of them is a bug a reader sees.
Each item is optional. File a separate issue for an item before you build it. File and line references were read from code on 2026-11-03, not measured.
- Area:
@docs.plus/extension-hyperlink, the webapp link popovers, the link-metadata server - Source: the RFC: Desktop hyperlink hovercard #242 review, 2026-10-30, and the refactor round of 2026-11-03
Due before extension 2.3.0 publishes
- Public names. Renaming an export after the first publish is a breaking change, so do these first.
wholeLinkreads like a check, but it returns the link to store. Rename it, for example totoStoredLink. Two webapp files call it.HyperlinkOptions.linkIconandHovercardOptions.siteIconare typedLinkIconResolver, but the root exports onlyLinkIconContext. ExportLinkIconResolvertoo.- Name the hovercard callback contexts
HovercardContext({ href }) andHovercardShowContext({ href; link }) inhovercard/types.ts. Only the name is new; the shape stays.
Candidates
Extension (extensions/extension-hyperlink)
- One link-target module. "Which link did this event hit" and "open with Mod or the middle button" are each written three times:
interactions/clickHandler.ts,hovercard/hovercardPlugin.ts, the openers andhovercard/content.ts. Move them into onelinkTarget.tswith onebindOpenGestureshelper. - Click handler modes.
openPreviewPopoverFromClickis now a three-mode function with 3 call sites inclickHandler.ts, and the click handler repeats its point maths. Split the modes, or let the caller pass the point. - Mod cursor state.
interactions/modCursor.tskeeps its handlers at module level and finds its document again through a cast chain. Bind the handlers per document instead. - Keyboard-open preview.
focusPreviewFromKeyboardfinds the preview it just opened again, throughgetState()and the'preview'kind string. Add an internalmountPreview(opts): Popover | null, so callers pass the mounted element. - Link context lookup. Finding the link context takes two lookups and one cast, and returns a silent
nullwhere the caller already has the context. Pass the context down. - Icon resolver copy. The hovercard repeats
resolvefromlinkIconMarkViewnearly word for word. Share one helper. - Hovercard timing state.
Pendingis a bag of optional stamps (dataAt,pictureAt). Work out the open deadline when each event arrives instead:max(enteredAt + 500, now + 300)on data with a picture, andmax(enteredAt + 500, now)otherwise. That matches the ruled timing in every order, andhovercard.cy.tspins it.
Webapp (apps/webapp/src/components/TipTap/hyperlinkPopovers)
- Two new-tab shapes. An open with a new-tab intent has two shapes:
navigateHref(href, isAllowedUri, event)andpadNavigate(href, { newTab }). Both now use the extension'shasMod, so they agree on keys. See Decision 2. - Filter link branches. Filter links branch in four places, and the descriptor uses optional fields to cover that. Use a
FILTER_MODE_LABELmap and drophideFilterSublabel. - Edit-form seed. The desktop and mobile popover entries copy the edit-form seed, and the two copies grew in lockstep. Share one seed.
- Mod-cursor CSS copy. The webapp keeps a lockstep copy of the extension's Mod-held hand rule in
document-styles.scss, because it does not import the extension'sstyles.css. Keep it, or ship the rule as its own small stylesheet.
Link-metadata server (apps/hocuspocus.server/src/modules/link-metadata)
- Scraper threading.
pipeline.tsthreadsscraperthrough four layers for one stage (name === 'html'), andcapCardlives in the orchestrator. Bind the scraper inmodule.ts, keep one success builder, and movecapCardtodomain/card.ts. - Two owners for URL cleaning.
utm_parameters are stripped in two places,infra/headScraper.tsandcanonicalize.ts. Keep one owner. - Deadline copies. The deadline pattern is written five times, and some readers take an
AbortControlleronly to abort it. Share one deadline helper.
Decisions
- Ship the public names separately, on milestone v2.3.0? They are due before extension 2.3.0, and everything else here waits for v2.4.0.
- ➡️ Yes. Move that item to its own issue on v2.3.0. It is cheap now and breaking after the publish.
- One new-tab shape? Route the preview title link and the chat message body (
HTMLBody.tsx) throughpadNavigate(href, { newTab: hasMod(event) }), and delete theeventparameter ofnavigateHref.- ➡️ Yes. Mod-click on a link to this pad, in a chat message, then opens a new tab. It runs in place today. That matches Mod-click in the pad editor.
- One targeting rule for desktop Edit and Remove? Desktop Remove acts on the editor selection, because
y-prosemirrormoves the selection through a co-editor's change. Desktop Edit acts on thenodePosstored at open time, with anexpectedHrefguard. If a co-editor types above the link while the form is open, Edit then does nothing.- ➡️ First check whether the selection always sits on the link when the desktop form opens. If it does, make desktop Edit act on the selection too. If it does not, keep both rules and say why in
apps/webapp/src/components/TipTap/CLAUDE.md.
- ➡️ First check whether the selection always sits on the link when the desktop form opens. If it does, make desktop Edit act on the selection too. If it does not, keep both rules and say why in
- Close the "scraper rules written twice" item? The selector list is now 5 entries, after the
</headcut, so little copying is left.- ➡️ Yes. It is no longer listed above.
Activity
HMarzban commentedon Nov 4, 2026
Status after the 2026-11-04 work, on local
main, not pushed yet:1b8e6f3aa.wholeLinkis nowtoStoredLink, andLinkIconResolver,HovercardContextandHovercardShowContextare exported.9c548a355(Show link icons and the link preview in chat messages #694).navigateHreftakes no event, and every new-tab open goes throughpadNavigate(href, { newTab: hasMod(event) }).233cf5b7b, Keep a co-editor's link text when the prebuilt edit popover changes only the URL #643), and the reason is inapps/webapp/src/components/TipTap/CLAUDE.md.openPreviewPopover,focusPreviewFromKeyboardandlinkIconFor. The other candidates still wait for v2.4.0.feat(extension-hyperlink): add the Use page title action
fix(webapp): find the link again when a co-editor types above it
feat(webapp): give chat message links icons and a preview
fix(extension-hyperlink): give customValidator the stored link