refactoring

This commit is contained in:
Philipp Kühn
2020-08-18 09:36:37 +02:00
parent 39b96e4244
commit 73474a486e

View File

@@ -40,13 +40,15 @@ interface EditorOptions {
@magicMethods
export class Editor extends EventEmitter {
proxy!: any
extensionManager!: ExtensionManager
schema!: Schema
view!: EditorView
commands: { [key: string]: any } = {}
css!: HTMLStyleElement
options: EditorOptions = {
private proxy!: any
private extensionManager!: ExtensionManager
private commands: { [key: string]: any } = {}
private css!: HTMLStyleElement
private lastCommand = Promise.resolve()
public schema!: Schema
public view!: EditorView
public selection = { from: 0, to: 0 }
private options: EditorOptions = {
element: document.createElement('div'),
content: '',
injectCSS: true,
@@ -54,10 +56,6 @@ export class Editor extends EventEmitter {
renderer: null,
}
private lastCommand = Promise.resolve()
public selection = { from: 0, to: 0 }
constructor(options: Partial<EditorOptions> = {}) {
super()
this.options = { ...this.options, ...options }
@@ -87,7 +85,7 @@ export class Editor extends EventEmitter {
}
}
__get(name: string) {
private __get(name: string) {
const command = this.commands[name]
if (!command) {