Skip to content

Commit

Permalink
fix: deinitialize codemirror on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode authored and evanplaice committed Sep 27, 2020
1 parent 4c7622b commit 0cd9c75
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wc-codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export class WCCodeMirror extends HTMLElement {
this.__initialized = true
}

disconnectedCallback() {
this.editor && this.editor.toTextArea()
this.editor = null
this.__initialized = false
}

async setSrc () {
const src = this.getAttribute('src')
const contents = await this.fetchSrc(src)
Expand Down

0 comments on commit 0cd9c75

Please sign in to comment.