remove styling on destroy

This commit is contained in:
Philipp Kühn
2020-03-31 13:06:34 +02:00
parent c9bcb49788
commit d869847da1
3 changed files with 18 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ import getAllMethodNames from './utils/getAllMethodNames'
import nodeIsActive from './utils/nodeIsActive'
import markIsActive from './utils/markIsActive'
import getMarkAttrs from './utils/getMarkAttrs'
import removeElement from './utils/removeElement'
import getSchemaTypeByName from './utils/getSchemaTypeByName'
import ExtensionManager from './ExtensionManager'
import Extension from './Extension'
@@ -44,6 +45,7 @@ export class Editor extends EventEmitter {
extensions: [],
}
commands: { [key: string]: any } = {}
css!: HTMLStyleElement
private lastCommand = Promise.resolve()
@@ -62,7 +64,7 @@ export class Editor extends EventEmitter {
this.registerCommand('clearContent', require('./commands/clearContent').default)
if (this.options.injectCSS) {
injectCSS(require('./style.css'))
this.css = injectCSS(require('./style.css'))
}
}
@@ -232,6 +234,7 @@ export class Editor extends EventEmitter {
this.view.destroy()
this.removeAllListeners()
removeElement(this.css)
}
}