Skip to content

Links: an editor for a link's words and where it goes, which also finds pages - #214

Merged
LoopyDev merged 1 commit into
mainfrom
feat/link-editor
Nov 14, 2026
Merged

LoopyDev merged 1 commit into
mainfrom
feat/link-editor

Conversation

@LoopyDev

Copy link
Copy Markdown
Owner

Links were added with the browser's prompt: one box, for the address. The slash menu's "Link" used the address itself as the link's words, and clicking any link opened it in a new tab, Wikid pages included.

The link editor (LinkEditor.vue)

  • It has two fields: Text (the words shown) and Link (where it goes).
  • It opens from the toolbar's Link button, /link, or ⌘/Ctrl+K. ⌘K opens it when words are chosen or the cursor is in a link. Otherwise ⌘K stays the app's search: it used to open both, with search on top. The app's search shortcut now skips a key the editor has already taken.
  • With the cursor in a link, or words chosen within one, it edits that link, and Remove link takes it off. Words chosen just after a link, and /link typed straight after one, make a new link.
  • The Link box searches pages (titles and icons, arrow keys or the mouse). A page link is saved as /doc/<id>, keeping any #block-….
  • Words across several blocks are linked as they are; their text can't be rewritten, because that merged the blocks. New words keep the old ones' bold, italic and colour. It doesn't open in code.
  • Only web addresses, mailto:, tel: and places on this site are taken. javascript: and the like are refused, with a message.
  • Keyboard and screen readers: a combobox with aria-activedescendant. Escape closes the list of pages, then the editor. Tab goes round inside it.

Where the link goes

  • With live editing on, the link's words are kept as Yjs relative positions, as the cursors are. Someone typing earlier in the line meanwhile doesn't move the link onto other words. Without live editing, the positions follow each change.
  • If the words are deleted meanwhile, nothing is changed.

Clicking links

  • A page link opens the page here (workspace.openPageFromLink: loaded if it isn't in the list, or a word on why it can't be opened). Other links open in a new tab.
  • Shift-click is left to the selection.

Links keep their words. Links are no longer inclusive. With autolink, Tiptap had a link take in what was typed at its end: the next word joined it, and a space was lost.

Also changed

  • The text toolbar is hidden while the link editor is open, not taken out. Taking its plugin out had live editing redraw the whole page.
  • One /doc/ address parser (pageLinkTarget, in utils/editorLinks.js) is shared by the click handler and the link editor.

Tests: e2e/links.spec.ts, 11 tests:

  • linking chosen words from the toolbar;
  • ⌘K stays search with nothing chosen;
  • /link adds a link with its own words, and typing goes on after it;
  • changing and removing a link;
  • page search, and a page link opening in place;
  • Escape changes nothing;
  • javascript: is refused;
  • a new link right after another;
  • bold kept;
  • the link lands on the right words while Bob types earlier in the line.

Page mentions (@ / [[) come next, in their own PR.

🤖 Generated with Claude Code

…ds pages

The browser prompt (one box: the address) is replaced by a link editor with Text and Link, opened
from the toolbar, "/link" or ⌘K (with words chosen or the cursor in a link; otherwise ⌘K is still
search). The Link box searches pages: a link to one opens it here, not in a new tab. Unsafe
addresses are refused, the link stays on its words while others edit, and links no longer take in
what's typed after them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LoopyDev
LoopyDev merged commit 3e01b30 into main Nov 14, 2026
7 checks passed
@LoopyDev
LoopyDev deleted the feat/link-editor branch November 14, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant