From f8cedae3bb560a8c7ffaa8560464f5cf0d3b4686 Mon Sep 17 00:00:00 2001
From: Matthew Lipski
Date: Fri, 17 Apr 2026 17:44:43 +0200
Subject: [PATCH 1/3] Fixed non-editable link clicks opening duplicate tabs
---
.../managers/ExtensionManager/extensions.ts | 23 +++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/packages/core/src/editor/managers/ExtensionManager/extensions.ts b/packages/core/src/editor/managers/ExtensionManager/extensions.ts
index 82371b26c6..f8e60494b2 100644
--- a/packages/core/src/editor/managers/ExtensionManager/extensions.ts
+++ b/packages/core/src/editor/managers/ExtensionManager/extensions.ts
@@ -2,6 +2,7 @@ import {
AnyExtension as AnyTiptapExtension,
extensions,
getAttributes,
+ mergeAttributes,
Node,
Extension as TiptapExtension,
} from "@tiptap/core";
@@ -117,7 +118,13 @@ export function getDefaultTiptapExtensions(
let link: HTMLAnchorElement | null = null;
- if (event.target instanceof HTMLAnchorElement) {
+ if (
+ event.target instanceof HTMLAnchorElement &&
+ // Differentiate between link inline content and read-only links.
+ event.target.hasAttribute("data-inline-content-type") &&
+ event.target.getAttribute("data-inline-content-type") ===
+ "link"
+ ) {
link = event.target;
} else {
const target = event.target as HTMLElement | null;
@@ -128,8 +135,10 @@ export function getDefaultTiptapExtensions(
const root = tiptapEditor.view.dom;
// Intentionally limit the lookup to the editor root.
- // Using tag names like DIV as boundaries breaks with custom NodeViews.
- link = target.closest("a");
+ // Using tag names like DIV as boundaries breaks with custom NodeViews,
+ link = target.closest(
+ 'a[data-inline-content-type="link"]',
+ );
if (link && !root.contains(link)) {
link = null;
@@ -178,7 +187,13 @@ export function getDefaultTiptapExtensions(
defaultProtocol: DEFAULT_LINK_PROTOCOL,
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
protocols: LINKIFY_INITIALIZED ? [] : VALID_LINK_PROTOCOLS,
- HTMLAttributes: options.links?.HTMLAttributes ?? {},
+ HTMLAttributes: mergeAttributes(
+ {
+ className: "bn-inline-content-section",
+ "data-inline-content-type": "link",
+ },
+ options.links?.HTMLAttributes ?? {},
+ ),
// Always false as we handle clicks ourselves above.
openOnClick: false,
}),
From 691fa1e3569710d8ae7fe1846332def14a16a4eb Mon Sep 17 00:00:00 2001
From: Matthew Lipski
Date: Fri, 17 Apr 2026 19:34:27 +0200
Subject: [PATCH 2/3] Updated test snapshots
---
.../__snapshots__/blocknoteHTML/hardbreak/between-links.html | 4 ++++
.../export/__snapshots__/blocknoteHTML/hardbreak/link.html | 4 ++++
.../export/__snapshots__/blocknoteHTML/link/adjacent.html | 4 ++++
.../export/__snapshots__/blocknoteHTML/link/basic.html | 2 ++
.../export/__snapshots__/blocknoteHTML/link/styled.html | 4 ++++
.../export/__snapshots__/html/link/adjacent.html | 4 ++++
.../export/__snapshots__/html/link/basic.html | 2 ++
.../export/__snapshots__/html/link/styled.html | 4 ++++
8 files changed, 28 insertions(+)
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html
index 9e4b427c62..fbe9ef135f 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/between-links.html
@@ -6,12 +6,16 @@
Link1
Link2
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html
index 4cae02d67b..691a663449 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/hardbreak/link.html
@@ -6,12 +6,16 @@
Link1
Link1
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html
index 2408c611ac..b89f21cd59 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/adjacent.html
@@ -6,11 +6,15 @@
Website
Website2
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html
index 3daea90831..bfc8c80945 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/basic.html
@@ -6,6 +6,8 @@
Website
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html
index 2b9d4cb574..6c67039ff9 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/link/styled.html
@@ -7,12 +7,16 @@
Web
site
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html
index db99691d33..e37cee5aa7 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/adjacent.html
@@ -2,11 +2,15 @@
Website
Website2
\ No newline at end of file
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html
index 4b61e8c582..6174bf9428 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/basic.html
@@ -2,6 +2,8 @@
Website
\ No newline at end of file
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html
index fb7737f7f8..fd2832b117 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/html/link/styled.html
@@ -3,12 +3,16 @@
Web
site
\ No newline at end of file
From 0f9d21deacabfc5ea7f7b05d46eca784b22cb5fc Mon Sep 17 00:00:00 2001
From: Matthew Lipski
Date: Fri, 17 Apr 2026 19:38:33 +0200
Subject: [PATCH 3/3] Update test snapshots
---
.../export/__snapshots__/html/hardbreak/between-links.html | 4 ++++
.../export/__snapshots__/html/hardbreak/link.html | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html
index 701b5d4213..7b074b0120 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/between-links.html
@@ -2,12 +2,16 @@
Link1
Link2
\ No newline at end of file
diff --git a/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html
index 2c762aedc5..aab38c859f 100644
--- a/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html
+++ b/tests/src/unit/core/formatConversion/export/__snapshots__/html/hardbreak/link.html
@@ -2,12 +2,16 @@
Link1
Link1
\ No newline at end of file