From cfbee3a7ebb288e1ea076b52a69dd61cb858d807 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 6ab0d528a2..74b66a362c 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;
@@ -127,9 +134,11 @@ export function getDefaultTiptapExtensions(
const root = tiptapEditor.view.dom;
- // Tntentionally limit the lookup to the editor root.
+ // Intentionally limit the lookup to the editor root.
// Using tag names like DIV as boundaries breaks with custom NodeViews,
- link = target.closest("a");
+ link = target.closest(
+ 'a[data-inline-content-type="link"]',
+ );
if (link && !root.contains(link)) {
link = null;
@@ -177,7 +186,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 ae026fed819bc17a785dcb058b2ccd685462ca96 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 416095a58485de506ad81d6d54270f307829fff4 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