save a ref to the editor element and destroy only that when the component dismounts

This commit is contained in:
Jacob Overgaard
2023-06-22 14:13:12 +02:00
parent 6a692a6cec
commit 0e1d4afd01

View File

@@ -36,6 +36,7 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
#currentUser?: UmbLoggedInUser;
#auth?: typeof UMB_AUTH.TYPE;
#plugins: Array<new (args: TinyMcePluginArguments) => UmbTinyMcePluginBase> = [];
#editorRef?: tinymce.Editor | null = null;
protected getFormElement() {
return undefined;
@@ -70,7 +71,10 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
disconnectedCallback() {
super.disconnectedCallback();
tinymce.default.activeEditor?.destroy();
if (this.#editorRef) {
this.#editorRef.destroy();
}
}
/**