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 { TaskItem, TaskList } from '@tiptap/extension-list';
|
||||||
import { TableKit } from '@tiptap/extension-table';
|
import { TableKit } from '@tiptap/extension-table';
|
||||||
import { Markdown } from '@tiptap/markdown';
|
import { Markdown } from '@tiptap/markdown';
|
||||||
|
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight';
|
||||||
import StarterKit from '@tiptap/starter-kit';
|
import StarterKit from '@tiptap/starter-kit';
|
||||||
|
import { lowlight } from './highlight';
|
||||||
import { SlashCommand } from './slash-command';
|
import { SlashCommand } from './slash-command';
|
||||||
import { TaskInputRule } from './task-input-rule';
|
import { TaskInputRule } from './task-input-rule';
|
||||||
import {
|
import {
|
||||||
@ -98,8 +100,10 @@ class TiptapEditorInstance {
|
|||||||
linkOnPaste: true,
|
linkOnPaste: true,
|
||||||
HTMLAttributes: { rel: 'noopener noreferrer', target: '_blank' },
|
HTMLAttributes: { rel: 'noopener noreferrer', target: '_blank' },
|
||||||
},
|
},
|
||||||
|
codeBlock: false,
|
||||||
}),
|
}),
|
||||||
Markdown,
|
Markdown,
|
||||||
|
CodeBlockLowlight.configure({ lowlight }),
|
||||||
TableKit,
|
TableKit,
|
||||||
UploadImage,
|
UploadImage,
|
||||||
TaskList,
|
TaskList,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user