import type { Extensions } from '@tiptap/core' import { NodeBackground } from '@admin/components/custom/content-editor/tiptap-extension/node-background-extension' import { HorizontalRule } from '@admin/components/custom/content-editor/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension' import { MediaGalleryPlaceholderNode } from '@admin/components/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node-extension' import { RemovableImage } from '@admin/components/custom/content-editor/tiptap-node/removable-image-node/removable-image-node-extension' import { ContentEditorTaskItem } from '@admin/components/custom/content-editor/tiptap-node/task-item-node/task-item-node-extension' import { ActiveTableCell } from '@admin/utils/editor/active-table-cell' import { ContentEditorHighlight } from '@admin/utils/editor/content-editor-highlight' import { ContentEditorInlineMath } from '@admin/utils/editor/content-editor-inline-math' import { ContentEditorKeyboard } from '@admin/utils/editor/content-editor-keyboard' import { ContentEditorRawContentBlock } from '@admin/utils/editor/content-editor-raw-content-block' import { ContentEditorSubscript } from '@admin/utils/editor/content-editor-subscript' import { ContentEditorSuperscript } from '@admin/utils/editor/content-editor-superscript' import { ContentEditorUnderline } from '@admin/utils/editor/content-editor-underline' import { TaskList } from '@tiptap/extension-list' import Placeholder from '@tiptap/extension-placeholder' import { Table } from '@tiptap/extension-table' import { TableCell } from '@tiptap/extension-table-cell' import { TableHeader } from '@tiptap/extension-table-header' import { TableRow } from '@tiptap/extension-table-row' import { Typography } from '@tiptap/extension-typography' import { Focus, Selection } from '@tiptap/extensions' import { Markdown } from '@tiptap/markdown' import { StarterKit } from '@tiptap/starter-kit' // The content editor's extensions, shared by the live editor (`useContentEditor`) and the // server-rendered first paint (`renderContentEditorStatic`), so both build the same schema. export function getContentEditorExtensions(placeholder?: string): Extensions { return [ StarterKit.configure({ horizontalRule: false, underline: false, link: { openOnClick: false, enableClickSelection: true } }), HorizontalRule, TaskList, ContentEditorTaskItem.configure({ nested: true }), ContentEditorHighlight.configure({ multicolor: true }), ContentEditorUnderline, ContentEditorSubscript, ContentEditorSuperscript, ContentEditorKeyboard, ContentEditorInlineMath, ContentEditorRawContentBlock, RemovableImage, Table.configure({ cellMinWidth: 96, resizable: true }), TableRow, TableHeader, TableCell, ActiveTableCell, Typography, Selection, Focus.configure({ mode: 'shallowest' }), NodeBackground, Placeholder.configure({ placeholder: placeholder || "Write, type '/' for commands..." }), Markdown.configure({ markedOptions: { gfm: true } }), MediaGalleryPlaceholderNode.configure({ accept: 'image/*' }) ] }