tiptap/packages/extension-code-block-lowlight/src/code-block-lowlight.ts
Philipp Kühn 38f3601e6f Revert "feat: update lowlight to v2"
This reverts commit 7e96d98a21.
2021-06-03 21:20:36 +02:00

25 lines
589 B
TypeScript

import lowlight from 'lowlight/lib/core'
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
import { LowlightPlugin } from './lowlight-plugin'
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
lowlight: any,
}
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
defaultOptions: {
...CodeBlock.options,
lowlight,
},
addProseMirrorPlugins() {
return [
...this.parent?.() || [],
LowlightPlugin({
name: 'codeBlock',
lowlight: this.options.lowlight,
}),
]
},
})