import { NodeSpec, NodeType } from 'prosemirror-model' import Extension, { ExtensionCallback, ExtensionExtends } from './Extension' import { Editor } from './Editor' interface NodeCallback { name: string editor: Editor options: Options type: NodeType } export interface NodeExtends extends ExtensionExtends { topNode: boolean schema: (params: Omit) => NodeSpec } export default class Node< Options = {}, Callback = NodeCallback, Extends extends NodeExtends = NodeExtends > extends Extension { type = 'node' public topNode(value: Extends['topNode'] = true) { this.storeConfig('topNode', value, 'overwrite') return this } public schema(value: Extends['schema']) { this.storeConfig('schema', value, 'overwrite') return this } }