mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-19 13:47:51 +08:00
23 lines
455 B
TypeScript
23 lines
455 B
TypeScript
|
import { Node } from '@tiptap/core'
|
||
|
import { NodeSpec } from 'prosemirror-model'
|
||
|
|
||
|
export default class CodeBlock extends Node {
|
||
|
|
||
|
name = 'code_block'
|
||
|
|
||
|
schema(): NodeSpec {
|
||
|
return {
|
||
|
content: 'text*',
|
||
|
marks: 'italic',
|
||
|
group: 'block',
|
||
|
code: true,
|
||
|
defining: true,
|
||
|
draggable: false,
|
||
|
parseDOM: [
|
||
|
{ tag: 'pre', preserveWhitespace: 'full' },
|
||
|
],
|
||
|
toDOM: () => ['pre', ['code', 0]],
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|