add basic extension classes
This commit is contained in:
@@ -1,33 +1,59 @@
|
||||
import { NodeSpec, NodeType } from 'prosemirror-model'
|
||||
import Extension, { ExtensionMethods } from './Extension'
|
||||
import { Editor } from './Editor'
|
||||
// import { NodeSpec, NodeType } from 'prosemirror-model'
|
||||
// import Extension, { ExtensionMethods } from './Extension'
|
||||
// import { Editor } from './Editor'
|
||||
|
||||
export interface NodeProps<Options> {
|
||||
name: string
|
||||
editor: Editor
|
||||
options: Options
|
||||
type: NodeType
|
||||
}
|
||||
// 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 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
|
||||
// }
|
||||
// }
|
||||
|
||||
import Extension from './Extension'
|
||||
|
||||
export default class Node<Options = {}> extends Extension<Options> {
|
||||
|
||||
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
|
||||
topNode = false
|
||||
|
||||
group = ''
|
||||
|
||||
content = ''
|
||||
|
||||
createAttributes() {
|
||||
return {}
|
||||
}
|
||||
|
||||
public schema(value: Methods['schema']) {
|
||||
this.storeConfig('schema', value, 'overwrite')
|
||||
return this
|
||||
parseHTML() {
|
||||
return []
|
||||
}
|
||||
|
||||
renderHTML() {
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user