From 633e78fcd33223dca8020fb432653f3d77df43aa Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 4 Dec 2025 15:11:28 +0000 Subject: [PATCH] fix(rte): Deduplicate Tiptap extensions to prevent duplicate name warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When multiple Umbraco extensions (e.g., BulletList and OrderedList) include the same Tiptap extension (ListItem), duplicates were added to the extensions array, causing Tiptap to log warnings. This change uses a Map to deduplicate extensions by their name property before passing them to the Editor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/input-tiptap/input-tiptap.element.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts index 89996511511c..0ff052abe38e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts @@ -1,6 +1,6 @@ import { Editor } from '../../externals.js'; import { UmbTiptapRteContext } from '../../contexts/tiptap-rte.context.js'; -import type { Extensions } from '../../externals.js'; +import type { AnyExtension } from '../../externals.js'; import type { UmbTiptapExtensionApi } from '../../extensions/types.js'; import type { UmbTiptapStatusbarValue, UmbTiptapToolbarValue } from '../types.js'; import { @@ -156,12 +156,16 @@ export class UmbInputTiptapElement extends UmbFormControlMixin('toolbar') ?? [[[]]]; this._statusbar = this.configuration?.getValueByAlias('statusbar') ?? []; - const tiptapExtensions: Extensions = []; + const tiptapExtensions = new Map(); this._extensions.forEach((ext) => { const tiptapExt = ext.getTiptapExtensions({ configuration: this.configuration }); if (tiptapExt?.length) { - tiptapExtensions.push(...tiptapExt); + tiptapExt.forEach((extension) => { + if (!tiptapExtensions.has(extension.name)) { + tiptapExtensions.set(extension.name, extension); + } + }); } const styles = ext.getStyles(); @@ -179,7 +183,7 @@ export class UmbInputTiptapElement extends UmbFormControlMixin