refactoring
This commit is contained in:
@@ -40,13 +40,15 @@ interface EditorOptions {
|
|||||||
@magicMethods
|
@magicMethods
|
||||||
export class Editor extends EventEmitter {
|
export class Editor extends EventEmitter {
|
||||||
|
|
||||||
proxy!: any
|
private proxy!: any
|
||||||
extensionManager!: ExtensionManager
|
private extensionManager!: ExtensionManager
|
||||||
schema!: Schema
|
private commands: { [key: string]: any } = {}
|
||||||
view!: EditorView
|
private css!: HTMLStyleElement
|
||||||
commands: { [key: string]: any } = {}
|
private lastCommand = Promise.resolve()
|
||||||
css!: HTMLStyleElement
|
public schema!: Schema
|
||||||
options: EditorOptions = {
|
public view!: EditorView
|
||||||
|
public selection = { from: 0, to: 0 }
|
||||||
|
private options: EditorOptions = {
|
||||||
element: document.createElement('div'),
|
element: document.createElement('div'),
|
||||||
content: '',
|
content: '',
|
||||||
injectCSS: true,
|
injectCSS: true,
|
||||||
@@ -54,10 +56,6 @@ export class Editor extends EventEmitter {
|
|||||||
renderer: null,
|
renderer: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
private lastCommand = Promise.resolve()
|
|
||||||
|
|
||||||
public selection = { from: 0, to: 0 }
|
|
||||||
|
|
||||||
constructor(options: Partial<EditorOptions> = {}) {
|
constructor(options: Partial<EditorOptions> = {}) {
|
||||||
super()
|
super()
|
||||||
this.options = { ...this.options, ...options }
|
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]
|
const command = this.commands[name]
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user