fix: allow multiple editors on the page

tinymce does not support having the same html id on its root elements (even though it's a Shadow DOM), so we use an html class instead and tinymce is happy
This commit is contained in:
Jacob Overgaard
2024-05-10 15:33:09 +02:00
parent bd80bd312e
commit ae207b1c12

View File

@@ -12,8 +12,12 @@ import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbStylesheetDetailRepository, UmbStylesheetRuleManager } from '@umbraco-cms/backoffice/stylesheet';
import { UUIFormControlMixin } from '@umbraco-cms/backoffice/external/uui';
import type { EditorEvent, Editor, RawEditorOptions } from '@umbraco-cms/backoffice/external/tinymce';
import type { ManifestTinyMcePlugin } from '@umbraco-cms/backoffice/extension-registry';
import {
type EditorEvent,
type Editor,
type RawEditorOptions,
renderEditor,
} from '@umbraco-cms/backoffice/external/tinymce';
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
/**
@@ -74,7 +78,7 @@ export class UmbInputTinyMceElement extends UUIFormControlMixin(UmbLitElement, '
return super.value;
}
@query('#editor', true)
@query('.editor', true)
private _editorElement?: HTMLElement;
protected async firstUpdated(): Promise<void> {
@@ -347,7 +351,7 @@ export class UmbInputTinyMceElement extends UUIFormControlMixin(UmbLitElement, '
* a target div and binds the RTE to that element
*/
render() {
return html`<div id="editor"></div>`;
return html`<div class="editor"></div>`;
}
static styles = [