remove server path because the test collides with the auth app, which mustn't be imported like this -- also the server url should be provided from the server

This commit is contained in:
Jacob Overgaard
2024-03-04 11:42:28 +01:00
parent 022740694c
commit c3367f9925

View File

@@ -8,12 +8,10 @@ import { FormControlMixin } from '@umbraco-cms/backoffice/external/uui';
import type { EditorEvent, Editor, RawEditorOptions } from '@umbraco-cms/backoffice/external/tinymce';
import { loadManifestApi } from '@umbraco-cms/backoffice/extension-api';
import { type ManifestTinyMcePlugin, umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
import { css, customElement, html, property, query, state } from '@umbraco-cms/backoffice/external/lit';
import { firstValueFrom } from '@umbraco-cms/backoffice/external/rxjs';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
import { UMB_APP_CONTEXT } from '@umbraco-cms/backoffice/app';
import { UmbStylesheetDetailRepository, UmbStylesheetRuleManager } from '@umbraco-cms/backoffice/stylesheet';
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
@@ -57,8 +55,7 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
#renderEditor?: typeof import('@umbraco-cms/backoffice/external/tinymce').renderEditor;
#plugins: Array<new (args: TinyMcePluginArguments) => UmbTinyMcePluginBase> = [];
#editorRef?: Editor | null = null;
#stylesheetRepository: UmbStylesheetDetailRepository;
#serverUrl?: string;
#stylesheetRepository = new UmbStylesheetDetailRepository(this);
#umbStylesheetRuleManager = new UmbStylesheetRuleManager();
protected getFormElement() {
@@ -81,19 +78,7 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
@query('#editor', true)
private _editorElement?: HTMLElement;
constructor() {
super();
this.consumeContext(UMB_APP_CONTEXT, (instance) => {
this.#serverUrl = instance.getServerUrl();
});
this.#stylesheetRepository = new UmbStylesheetDetailRepository(this);
}
protected async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {
super.firstUpdated(_changedProperties);
protected async firstUpdated(): Promise<void> {
// Here we want to start the loading of everything at first, not one at a time, which is why this code is not using await.
const loadEditor = import('@umbraco-cms/backoffice/external/tinymce').then((tinyMce) => {
this.#renderEditor = tinyMce.renderEditor;
@@ -202,9 +187,7 @@ export class UmbInputTinyMceElement extends FormControlMixin(UmbLitElement) {
// Map the stylesheets with server url
const stylesheets =
stylesheetPaths?.map(
(stylesheetPath: string) => `${this.#serverUrl}/css/${stylesheetPath.replace(/\\/g, '/')}`,
) ?? [];
stylesheetPaths?.map((stylesheetPath: string) => `/css${stylesheetPath.replace(/\\/g, '/')}`) ?? [];
stylesheets.push('/umbraco/backoffice/css/rte-content.css');