tiptap/packages/tiptap-core/src/Extension.ts

47 lines
667 B
TypeScript
Raw Normal View History

2019-12-17 06:20:05 +08:00
import { Editor } from './Editor'
2020-03-06 03:30:58 +08:00
export default abstract class Extension {
2019-12-17 06:20:05 +08:00
constructor(options = {}) {
this.options = {
...this.defaultOptions,
...options,
}
}
2020-03-06 05:40:02 +08:00
editor!: Editor
options: { [key: string]: any } = {}
defaultOptions: { [key: string]: any } = {}
public abstract name: string
public type = 'extension'
2019-12-17 06:20:05 +08:00
2020-03-06 05:40:02 +08:00
protected init() {}
2019-12-17 06:20:05 +08:00
2020-03-06 05:40:02 +08:00
protected bindEditor(editor: Editor): void {
2019-12-17 06:20:05 +08:00
this.editor = editor
}
get update(): any {
return () => {}
}
get plugins(): any {
return []
}
inputRules(): any {
return []
}
pasteRules(): any {
return []
}
keys(): any {
return {}
}
}