tiptap/packages/core/src/Node.ts

71 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-10-10 04:59:25 +08:00
// import { NodeSpec, NodeType } from 'prosemirror-model'
// import Extension, { ExtensionMethods } from './Extension'
// import { Editor } from './Editor'
2019-12-17 06:20:05 +08:00
2020-10-10 04:59:25 +08:00
// export interface NodeProps<Options> {
// name: string
// editor: Editor
// options: Options
// type: NodeType
// }
// export interface NodeMethods<Props, Options> extends ExtensionMethods<Props, Options> {
// topNode: boolean
// schema: (params: Omit<Props, 'type' | 'editor'>) => NodeSpec
// }
// export default class Node<
// Options = {},
// Props = NodeProps<Options>,
// Methods extends NodeMethods<Props, Options> = NodeMethods<Props, Options>,
// > extends Extension<Options, Props, Methods> {
// type = 'node'
// public topNode(value: Methods['topNode'] = true) {
// this.storeConfig('topNode', value, 'overwrite')
// return this
// }
// public schema(value: Methods['schema']) {
// this.storeConfig('schema', value, 'overwrite')
// return this
// }
// }
2020-10-12 16:32:54 +08:00
import { DOMOutputSpec, DOMOutputSpecArray } from 'prosemirror-model'
2020-10-10 04:59:25 +08:00
import Extension from './Extension'
2020-10-12 16:32:54 +08:00
export interface INode {
type: string
topNode: boolean
group: string
content: string
createAttributes(): any
parseHTML(): any
renderHTML(props: number): DOMOutputSpec
}
export default class Node<Options = {}> extends Extension<Options> implements INode {
2020-09-09 05:44:45 +08:00
type = 'node'
2020-10-10 04:59:25 +08:00
topNode = false
group = ''
content = ''
createAttributes() {
return {}
2020-03-30 18:40:25 +08:00
}
2020-10-10 04:59:25 +08:00
parseHTML() {
return []
2020-09-09 05:44:45 +08:00
}
2020-10-10 04:59:25 +08:00
renderHTML() {
2020-10-12 16:32:54 +08:00
return null
2020-10-10 04:59:25 +08:00
}
2019-12-17 06:20:05 +08:00
}