fix some types

This commit is contained in:
Philipp Kühn 2020-04-14 10:13:27 +02:00
parent aa557af648
commit 34b8f18a57
2 changed files with 12 additions and 15 deletions

View File

@ -29,11 +29,11 @@ export interface CommandSpec {
type EditorContent = string | JSON | null
interface Options {
element?: HTMLElement,
content?: EditorContent
extensions?: (Extension | Node | Mark)[]
injectCSS?: Boolean
interface EditorOptions {
element: HTMLElement,
content: EditorContent
extensions: (Extension | Node | Mark)[]
injectCSS: Boolean,
}
@magicMethods
@ -43,24 +43,24 @@ export class Editor extends EventEmitter {
extensionManager!: ExtensionManager
schema!: Schema
view!: EditorView
options: Options = {
commands: { [key: string]: any } = {}
css!: HTMLStyleElement
options: EditorOptions = {
element: document.createElement('div'),
content: '',
injectCSS: true,
extensions: [],
}
commands: { [key: string]: any } = {}
css!: HTMLStyleElement
private lastCommand = Promise.resolve()
public selection = { from: 0, to: 0 }
constructor(options: Options) {
constructor(options: Partial<EditorOptions> = {}) {
super()
this.options = { ...this.options, ...options }
}
private init() {
this.createExtensionManager()
this.createSchema()

View File

@ -11,11 +11,8 @@
"experimentalDecorators": true,
"sourceMap": true,
"baseUrl": ".",
"allowJs": true,
"checkJs": true,
"types": [
"node"
],
"allowJs": false,
"checkJs": false,
"paths": {
"@/*": [
"packages/*"