tiptap/packages/extension-codeblock/index.ts

23 lines
449 B
TypeScript
Raw Normal View History

2020-04-02 14:53:59 +08:00
import { Node } from '@tiptap/core'
import { NodeSpec } from 'prosemirror-model'
export default class CodeBlock extends Node {
name = 'code_block'
schema(): NodeSpec {
return {
content: 'text*',
2020-04-02 18:42:02 +08:00
marks: '',
2020-04-02 14:53:59 +08:00
group: 'block',
code: true,
defining: true,
draggable: false,
parseDOM: [
{ tag: 'pre', preserveWhitespace: 'full' },
],
toDOM: () => ['pre', ['code', 0]],
}
}
}