From d4745be8487bab3153a1b584134ed141c6500dea Mon Sep 17 00:00:00 2001 From: Eugeny Date: Wed, 25 Feb 2026 03:20:47 +0300 Subject: [PATCH 1/5] fix(inline-tool-link): use defaultValue to prevent selectionchange event --- docs/CHANGELOG.md | 4 ++++ package.json | 2 +- src/components/inline-tools/inline-tool-link.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 751942620..ce1e69970 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 2.31.4 + +- `Fix` - Prevent inline-toolbar re-renders when linked text is selected + ### 2.31.3 - `Fix` - Prevent text formatting removal when applying link diff --git a/package.json b/package.json index e17e6f2ac..49b61542d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/editorjs", - "version": "2.31.3", + "version": "2.31.4", "description": "Editor.js — open source block-style WYSIWYG editor with JSON output", "main": "dist/editorjs.umd.js", "module": "dist/editorjs.mjs", diff --git a/src/components/inline-tools/inline-tool-link.ts b/src/components/inline-tools/inline-tool-link.ts index 999a30c4c..0bef25c73 100644 --- a/src/components/inline-tools/inline-tool-link.ts +++ b/src/components/inline-tools/inline-tool-link.ts @@ -212,7 +212,7 @@ export default class LinkInlineTool implements InlineTool { */ const hrefAttr = anchorTag.getAttribute('href'); - this.nodes.input.value = hrefAttr !== 'null' ? hrefAttr : ''; + this.nodes.input.defaultValue = hrefAttr !== 'null' ? hrefAttr : ''; this.selection.save(); } else { From ae90e03c602725259f262570746495c1eaa8107f Mon Sep 17 00:00:00 2001 From: Eugeny Date: Wed, 4 Mar 2026 01:39:00 +0300 Subject: [PATCH 2/5] fix(link-tool): handle formatted linked text clicks --- src/components/modules/ui.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/modules/ui.ts b/src/components/modules/ui.ts index a4d3baad3..a28da024a 100644 --- a/src/components/modules/ui.ts +++ b/src/components/modules/ui.ts @@ -771,7 +771,7 @@ export default class UI extends Module { * case when user clicks on anchor element * if it is clicked via ctrl key, then we open new window with url */ - const element = event.target as Element; + const element = (event.target as Element).closest("a"); const ctrlKey = event.metaKey || event.ctrlKey; if ($.isAnchor(element) && ctrlKey) { From 582e137b77a159aa7d9d6c6459e9694d426463ad Mon Sep 17 00:00:00 2001 From: Eugeny Date: Wed, 4 Mar 2026 02:23:23 +0300 Subject: [PATCH 3/5] fix test errors --- src/components/modules/ui.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/modules/ui.ts b/src/components/modules/ui.ts index a28da024a..937dbc241 100644 --- a/src/components/modules/ui.ts +++ b/src/components/modules/ui.ts @@ -771,10 +771,11 @@ export default class UI extends Module { * case when user clicks on anchor element * if it is clicked via ctrl key, then we open new window with url */ - const element = (event.target as Element).closest("a"); + const element = event.target as Element; const ctrlKey = event.metaKey || event.ctrlKey; + const hasParentAnchor = !!(event.target as Element).closest("a"); - if ($.isAnchor(element) && ctrlKey) { + if ((hasParentAnchor || $.isAnchor(element)) && ctrlKey) { event.stopImmediatePropagation(); event.stopPropagation(); From 53662dac03e4fb8ed36b5826c82e42d5920a2969 Mon Sep 17 00:00:00 2001 From: Eugeny Date: Wed, 4 Mar 2026 23:01:08 +0300 Subject: [PATCH 4/5] Revert "fix test errors" This reverts commit 582e137b77a159aa7d9d6c6459e9694d426463ad. --- src/components/modules/ui.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/modules/ui.ts b/src/components/modules/ui.ts index 937dbc241..a28da024a 100644 --- a/src/components/modules/ui.ts +++ b/src/components/modules/ui.ts @@ -771,11 +771,10 @@ export default class UI extends Module { * case when user clicks on anchor element * if it is clicked via ctrl key, then we open new window with url */ - const element = event.target as Element; + const element = (event.target as Element).closest("a"); const ctrlKey = event.metaKey || event.ctrlKey; - const hasParentAnchor = !!(event.target as Element).closest("a"); - if ((hasParentAnchor || $.isAnchor(element)) && ctrlKey) { + if ($.isAnchor(element) && ctrlKey) { event.stopImmediatePropagation(); event.stopPropagation(); From b4ce3b9cba99f4a9b5cf0dacbe4444532b393f80 Mon Sep 17 00:00:00 2001 From: Eugeny Date: Wed, 4 Mar 2026 23:01:38 +0300 Subject: [PATCH 5/5] Revert "fix(link-tool): handle formatted linked text clicks" This reverts commit ae90e03c602725259f262570746495c1eaa8107f. --- src/components/modules/ui.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/modules/ui.ts b/src/components/modules/ui.ts index a28da024a..a4d3baad3 100644 --- a/src/components/modules/ui.ts +++ b/src/components/modules/ui.ts @@ -771,7 +771,7 @@ export default class UI extends Module { * case when user clicks on anchor element * if it is clicked via ctrl key, then we open new window with url */ - const element = (event.target as Element).closest("a"); + const element = event.target as Element; const ctrlKey = event.metaKey || event.ctrlKey; if ($.isAnchor(element) && ctrlKey) {