remove languages option from codeblocklowlight
This commit is contained in:
@@ -1,27 +1,7 @@
|
||||
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
|
||||
import lowlight from 'lowlight/lib/core'
|
||||
import CodeBlock from '@tiptap/extension-code-block'
|
||||
import { LowlightPlugin } from './lowlight-plugin'
|
||||
|
||||
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
|
||||
languages: {
|
||||
[key: string]: Function,
|
||||
},
|
||||
}
|
||||
|
||||
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
|
||||
defaultOptions: {
|
||||
...CodeBlock.config.defaultOptions,
|
||||
languages: {},
|
||||
},
|
||||
|
||||
onBeforeCreate() {
|
||||
Object
|
||||
.entries(this.options.languages)
|
||||
.forEach(([name, mapping]) => {
|
||||
lowlight.registerLanguage(name, mapping)
|
||||
})
|
||||
},
|
||||
|
||||
export const CodeBlockLowlight = CodeBlock.extend({
|
||||
addProseMirrorPlugins() {
|
||||
return [
|
||||
LowlightPlugin({ name: 'codeBlock' }),
|
||||
|
||||
Reference in New Issue
Block a user