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

View File

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