From 73474a486ec220479efc7802cbcaf549181b9f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 18 Aug 2020 09:36:37 +0200 Subject: [PATCH] refactoring --- packages/core/src/Editor.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 54e2cf56..14da5c42 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -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 = {}) { 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) {