fix some types
This commit is contained in:
@@ -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 }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user