Files
tiptap/packages/core/src/Extension.ts
2020-08-22 00:12:34 +02:00

55 lines
829 B
TypeScript

import { Plugin } from 'prosemirror-state'
import { Editor, Command } from './Editor'
export default abstract class Extension {
constructor(options = {}) {
this.options = {
...this.defaultOptions(),
...options,
}
}
editor!: Editor
options: { [key: string]: any } = {}
public abstract name: string
public extensionType = 'extension'
public created() {}
public bindEditor(editor: Editor): void {
this.editor = editor
}
defaultOptions(): { [key: string]: any } {
return {}
}
update(): any {
return () => {}
}
plugins(): Plugin[] {
return []
}
inputRules(): any {
return []
}
pasteRules(): any {
return []
}
keys(): { [key: string]: Function } {
return {}
}
commands(): { [key: string]: Command } {
return {}
}
}