import StarterKit from '@tiptap/starter-kit'; import Link from '@tiptap/extension-link'; import Placeholder from '@tiptap/extension-placeholder'; import type { AnyExtension } from '@tiptap/core'; export interface BuildExtensionsOptions { /** Placeholder text shown when the doc is empty. */ placeholder?: string; /** Extra extensions to append (e.g. a configured Mention or SlashCommands). */ extra?: AnyExtension[]; } /** * The canonical extension set shared by `` and * `` — keeping them in sync guarantees that serialised HTML * matches what the editor produced. */ export function buildExtensions(options: BuildExtensionsOptions = {}): AnyExtension[] { const { placeholder = 'Write something…', extra = [] } = options; return [ StarterKit.configure({ link: false }), Link.configure({ openOnClick: false, autolink: true }), Placeholder.configure({ placeholder }), ...extra, ]; }