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