feat(editor): 用 CodeBlockLowlight 替换 StarterKit 自带 CodeBlock
禁用 StarterKit codeBlock,引入 CodeBlockLowlight + lowlight 实例。 代码块现在有实时语法高亮(ProseMirror decoration),language 属性 仍承载完整 info string(markdown 往返不变)。
This commit is contained in:
parent
e79e0d9ee2
commit
e86fe0767d
@ -3,7 +3,9 @@ import { FileHandler } from '@tiptap/extension-file-handler';
|
||||
import { TaskItem, TaskList } from '@tiptap/extension-list';
|
||||
import { TableKit } from '@tiptap/extension-table';
|
||||
import { Markdown } from '@tiptap/markdown';
|
||||
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight';
|
||||
import StarterKit from '@tiptap/starter-kit';
|
||||
import { lowlight } from './highlight';
|
||||
import { SlashCommand } from './slash-command';
|
||||
import { TaskInputRule } from './task-input-rule';
|
||||
import {
|
||||
@ -98,8 +100,10 @@ class TiptapEditorInstance {
|
||||
linkOnPaste: true,
|
||||
HTMLAttributes: { rel: 'noopener noreferrer', target: '_blank' },
|
||||
},
|
||||
codeBlock: false,
|
||||
}),
|
||||
Markdown,
|
||||
CodeBlockLowlight.configure({ lowlight }),
|
||||
TableKit,
|
||||
UploadImage,
|
||||
TaskList,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user