Skip to content

feat: Link customization options (BLO-913)#2666

Merged
matthewlipski merged 2 commits intofeat/inline-tiptap-linkfrom
link-options-new
Apr 23, 2026
Merged

feat: Link customization options (BLO-913)#2666
matthewlipski merged 2 commits intofeat/inline-tiptap-linkfrom
link-options-new

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

Summary

This PR adds a new editor option:

links: Partial<{
  HTMLAttributes: Record<string, any>;
  onClick?: (event: MouseEvent) => void;
}>

These do basically what they say - HTMLAttributes adds HTML attributes to rendered link elements and onClick replaces the default click behaviour (which opens the link in a new tab).

Closes #1539

Rationale

Some users are finding it annoying that links open a new tab on click when they're just trying to move the selection.

HTML attributes allow for slight customization for link rendering. It's the best we can do atm, but really more of a stopgap solution as consumers should ideally be able to override the default link rendering with whatever they want.

Changes

See above.

Impact

N/A

Testing

N/A (example needed?)

Screenshots/Video

N/A

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview Apr 23, 2026 8:29am
blocknote-website Ready Ready Preview Apr 23, 2026 8:29am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b8d7c56-3555-4843-a854-49a6f6b739a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch link-options-new

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 21, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2666

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2666

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2666

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2666

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2666

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2666

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2666

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2666

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2666

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2666

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2666

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2666

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2666

commit: f6943a8

Comment on lines +51 to +52
options.onClick(event);
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we let the consumer decide the return value? i.e. undefined we interpret as true, but false we return false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that makes sense

Copy link
Copy Markdown
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right overall though!

@matthewlipski matthewlipski changed the title feat: Link customization options feat: Link customization options (BLO-913) Apr 23, 2026
@matthewlipski matthewlipski merged commit ddd42f8 into feat/inline-tiptap-link Apr 23, 2026
23 checks passed
@matthewlipski matthewlipski deleted the link-options-new branch April 23, 2026 08:44
nperez0111 pushed a commit that referenced this pull request Apr 24, 2026
* Added link customization options to editor

* Updated `onClick` to optionally return a boolean
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.

2 participants