fix type issue

This commit is contained in:
Philipp Kühn
2020-09-09 12:57:50 +02:00
parent 22109170b3
commit f56fae49a1
6 changed files with 38 additions and 61 deletions

View File

@@ -1,35 +1,20 @@
import { NodeSpec, NodeType } from 'prosemirror-model'
import Extension, { ExtensionCallback, ExtensionExtends } from './Extension'
import { Editor } from './Editor'
// export default abstract class Node extends Extension {
// constructor(options = {}) {
// super(options)
// }
// public extensionType = 'node'
// public topNode = false
// abstract schema(): NodeSpec
// get type() {
// return this.editor.schema.nodes[this.name]
// }
// }
export interface NodeCallback extends ExtensionCallback {
// TODO: fix optional
type?: NodeType
interface Callback {
name: string
editor: Editor
options: any
type: NodeType
}
export interface NodeExtends<Callback = NodeCallback> extends ExtensionExtends<Callback> {
export interface NodeExtends extends ExtensionExtends<Callback> {
topNode: boolean
schema: (params: Callback) => NodeSpec
}
export default class Node<Options = {}> extends Extension<Options, NodeExtends> {
export default class Node<Options = {}> extends Extension<Options, Callback, NodeExtends> {
type = 'node'
public topNode(value: NodeExtends['topNode'] = true) {