添加文章管理和文章分组页面
This commit is contained in:
60
src/components/editor/editorExtensions.ts
Normal file
60
src/components/editor/editorExtensions.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight"
|
||||
import Image from "@tiptap/extension-image"
|
||||
import Link from "@tiptap/extension-link"
|
||||
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 TaskItem from "@tiptap/extension-task-item"
|
||||
import TaskList from "@tiptap/extension-task-list"
|
||||
import TextAlign from "@tiptap/extension-text-align"
|
||||
import Underline from "@tiptap/extension-underline"
|
||||
import Youtube from "@tiptap/extension-youtube"
|
||||
import StarterKit from "@tiptap/starter-kit"
|
||||
import { common, createLowlight } from "lowlight"
|
||||
import { MdxPasteHandler } from "./extensions/mdx-paste-handler"
|
||||
|
||||
const lowlight = createLowlight(common)
|
||||
|
||||
export const editorExtensions = [
|
||||
MdxPasteHandler,
|
||||
StarterKit.configure({
|
||||
heading: {
|
||||
levels: [1, 2, 3],
|
||||
},
|
||||
codeBlock: false,
|
||||
}),
|
||||
Underline,
|
||||
Link.configure({
|
||||
openOnClick: false,
|
||||
HTMLAttributes: {
|
||||
class: "text-blue-600 underline cursor-pointer",
|
||||
},
|
||||
}),
|
||||
CodeBlockLowlight.configure({
|
||||
lowlight,
|
||||
}),
|
||||
Image.configure({
|
||||
HTMLAttributes: {
|
||||
class: "rounded-lg max-w-full",
|
||||
},
|
||||
}),
|
||||
TextAlign.configure({
|
||||
types: ["heading", "paragraph"],
|
||||
}),
|
||||
TaskList,
|
||||
TaskItem.configure({
|
||||
nested: true,
|
||||
}),
|
||||
Youtube.configure({
|
||||
HTMLAttributes: {
|
||||
class: "w-full aspect-video rounded-lg",
|
||||
},
|
||||
}),
|
||||
Table.configure({
|
||||
resizable: true,
|
||||
}),
|
||||
TableRow,
|
||||
TableHeader,
|
||||
TableCell,
|
||||
]
|
||||
Reference in New Issue
Block a user