fix: resolve tiptap duplicate Link extension warning

StarterKit 3.10+ now includes Link by default. Our code was adding
Link.configure() separately, causing duplicate extension warning and
breaking the email builder visual editor modal.

Fixed by configuring StarterKit with { link: false } so our custom
Link.configure() with specific options is the only Link extension.
This commit is contained in:
Dwindi Ramadhana
2026-01-01 01:16:47 +07:00
parent 9671c7255a
commit 8bd2713385

View File

@@ -45,7 +45,11 @@ export function RichTextEditor({
}: RichTextEditorProps) {
const editor = useEditor({
extensions: [
StarterKit,
// StarterKit 3.10+ includes Link by default, so disable it here
// since we configure Link separately below with custom options
StarterKit.configure({
link: false,
}),
Placeholder.configure({
placeholder,
}),
@@ -123,7 +127,7 @@ export function RichTextEditor({
const addImage = () => {
openWPMediaImage((file) => {
editor.chain().focus().setImage({
editor.chain().focus().setImage({
src: file.url,
alt: file.alt || file.title,
title: file.title,
@@ -328,7 +332,7 @@ export function RichTextEditor({
{__('Add a styled button to your content. Use variables for dynamic links.')}
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-4">
<div className="space-y-2">
<Label htmlFor="btn-text">{__('Button Text')}</Label>
@@ -339,7 +343,7 @@ export function RichTextEditor({
placeholder={__('e.g., View Order')}
/>
</div>
<div className="space-y-2">
<Label htmlFor="btn-href">{__('Button Link')}</Label>
<Input
@@ -362,7 +366,7 @@ export function RichTextEditor({
</div>
)}
</div>
<div className="space-y-2">
<Label htmlFor="btn-style">{__('Button Style')}</Label>
<Select value={buttonStyle} onValueChange={(value: 'solid' | 'outline') => setButtonStyle(value)}>
@@ -376,7 +380,7 @@ export function RichTextEditor({
</Select>
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => setButtonDialogOpen(false)}>
{__('Cancel')}