import StarterKit from "@tiptap/starter-kit"; import Placeholder from "@tiptap/extension-placeholder"; import { Markdown } from "tiptap-markdown"; import { AiHighlightExtension } from "./AiHighlightExtension"; // 注意:@tiptap v3 的 StarterKit 已内置 underline,不要再单独引入 @tiptap/extension-underline, // 否则会触发 "Duplicate extension names ['underline']" 警告并导致 useEditor schema 解析异常。 export const buildExtensions = (placeholder = "开始写作…") => [ StarterKit.configure({ // Disable hard break so Enter creates new paragraph hardBreak: false, }), Placeholder.configure({ placeholder, emptyEditorClass: "is-editor-empty", }), Markdown.configure({ html: false, transformCopiedText: true, transformPastedText: true, }), AiHighlightExtension, ];