Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Sep 30, 2020
1 parent 4d77e8c commit 93a29c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist/**
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = {
'./**/*.js',
'./**/*.vue',
],
excludedFiles: [
'dist/**',
],
plugins: [
'html',
'cypress',
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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
}

}
4 changes: 3 additions & 1 deletion packages/vue/src/components/EditorContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default Vue.extend({
},

beforeDestroy() {
this.editor.options.element = this.$el
this.editor.setOptions({
element: this.$el,
})
},
})

0 comments on commit 93a29c6

Please sign in to comment.