fix lint error

This commit is contained in:
Philipp Kühn 2020-09-30 22:43:58 +02:00
parent 4d77e8c4cc
commit 93a29c613c
4 changed files with 13 additions and 5 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
**/dist/**

View File

@ -14,9 +14,6 @@ module.exports = {
'./**/*.js',
'./**/*.vue',
],
excludedFiles: [
'dist/**',
],
plugins: [
'html',
'cypress',

View File

@ -159,7 +159,7 @@ export class Editor extends EventEmitter {
public setOptions(options: Partial<EditorOptions> = {}) {
this.options = { ...this.options, ...options }
if (this.view && this.state) {
if (this.view && this.state && !this.isDestroyed) {
this.view.updateState(this.state)
}
}
@ -399,4 +399,12 @@ export class Editor extends EventEmitter {
removeElement(this.css)
}
/**
* Check if the editor is already destroyed.
*/
private get isDestroyed() {
// @ts-ignore
return !this.view?.docView
}
}

View File

@ -27,6 +27,8 @@ export default Vue.extend({
},
beforeDestroy() {
this.editor.options.element = this.$el
this.editor.setOptions({
element: this.$el,
})
},
})