enable extensions init
This commit is contained in:
@@ -2,12 +2,6 @@ import { Editor } from './Editor'
|
||||
|
||||
export default abstract class Extension {
|
||||
|
||||
public abstract name: string
|
||||
|
||||
editor: any
|
||||
options: { [key: string]: any } = {}
|
||||
defaultOptions: { [key: string]: any } = {}
|
||||
|
||||
constructor(options = {}) {
|
||||
this.options = {
|
||||
...this.defaultOptions,
|
||||
@@ -15,16 +9,20 @@ export default abstract class Extension {
|
||||
}
|
||||
}
|
||||
|
||||
init(): any {
|
||||
return null
|
||||
}
|
||||
editor!: Editor
|
||||
options: { [key: string]: any } = {}
|
||||
defaultOptions: { [key: string]: any } = {}
|
||||
|
||||
bindEditor(editor: Editor): void {
|
||||
this.editor = editor
|
||||
}
|
||||
public abstract name: string
|
||||
|
||||
public type = 'extension'
|
||||
|
||||
protected init() {}
|
||||
|
||||
protected bindEditor(editor: Editor): void {
|
||||
this.editor = editor
|
||||
}
|
||||
|
||||
get update(): any {
|
||||
return () => {}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ export default class ExtensionManager {
|
||||
extensions: [any?]
|
||||
|
||||
constructor(extensions: any = [], editor: Editor) {
|
||||
// extensions.forEach(extension => {
|
||||
// extension.bindEditor(editor)
|
||||
// extension.init()
|
||||
// })
|
||||
this.extensions = extensions
|
||||
this.extensions.forEach(extension => {
|
||||
extension.bindEditor(editor)
|
||||
extension.init()
|
||||
})
|
||||
}
|
||||
|
||||
get nodes(): any {
|
||||
@@ -28,7 +28,7 @@ export default class ExtensionManager {
|
||||
.all()
|
||||
}
|
||||
|
||||
get plugins(): any {
|
||||
get plugins() {
|
||||
return collect(this.extensions)
|
||||
.flatMap(extension => extension.plugins)
|
||||
.toArray()
|
||||
|
||||
Reference in New Issue
Block a user