don't pass configuration into plugin ctor - is available on host arg already

This commit is contained in:
Nathan Woulfe
2023-06-26 10:01:34 +10:00
parent 0107c1bb3f
commit 6087708c4f
2 changed files with 6 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import { uriAttributeSanitizer } from './input-tiny-mce.sanitizer.js';
import { FormControlMixin, UUITextStyles } from '@umbraco-cms/backoffice/external/uui';
import { renderEditor, type tinymce } from '@umbraco-cms/backoffice/external/tinymce';
import { UMB_AUTH, UmbLoggedInUser } from '@umbraco-cms/backoffice/auth';
import type {
import {
TinyMcePluginArguments,
UmbDataTypePropertyCollection,
UmbTinyMcePluginBase,
@@ -167,7 +167,6 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
this.#editorRef.destroy();
}
// await tinymce.default.init(this._tinyConfig);
const editors = await renderEditor(this._tinyConfig);
this.#editorRef = editors.pop();
}
@@ -204,7 +203,7 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
// Plugins require a reference to the current editor as a param, so can not
// be instantiated until we have an editor
for (const plugin of this.#plugins) {
new plugin({ host: this, editor, configuration: this.configuration });
new plugin({ host: this, editor });
}
// define keyboard shortcuts

View File

@@ -1,21 +1,19 @@
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import type { UmbDataTypePropertyCollection } from '@umbraco-cms/backoffice/components';
import type { UmbDataTypePropertyCollection, UmbInputTinyMceElement } from '@umbraco-cms/backoffice/components';
import type { tinymce } from '@umbraco-cms/backoffice/external/tinymce';
export class UmbTinyMcePluginBase {
host: UmbLitElement;
host: UmbInputTinyMceElement;
editor: tinymce.Editor;
configuration?: UmbDataTypePropertyCollection;
constructor(arg: TinyMcePluginArguments) {
this.host = arg.host;
this.editor = arg.editor;
this.configuration = arg.configuration;
this.configuration = arg.host.configuration;
}
}
export interface TinyMcePluginArguments {
host: UmbLitElement;
host: UmbInputTinyMceElement;
editor: tinymce.Editor;
configuration?: UmbDataTypePropertyCollection;
}