diff --git a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/block-configuration/property-editor-ui-block-rte-type-configuration.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/block-configuration/property-editor-ui-block-rte-type-configuration.element.ts
index 2d97509a77..8c8b576052 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/block-configuration/property-editor-ui-block-rte-type-configuration.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/tiny-mce/property-editors/block-configuration/property-editor-ui-block-rte-type-configuration.element.ts
@@ -1,5 +1,4 @@
-import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type';
-import { UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type';
+import type { UmbBlockTypeBaseModel, UmbInputBlockTypeElement } from '@umbraco-cms/backoffice/block-type';
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
import {
@@ -7,6 +6,9 @@ import {
type UmbPropertyEditorConfigCollection,
} from '@umbraco-cms/backoffice/property-editor';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
+import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
+import { UMB_WORKSPACE_MODAL } from '@umbraco-cms/backoffice/modal';
+import { UMB_BLOCK_RTE_TYPE } from '@umbraco-cms/backoffice/block-rte';
/**
* @element umb-property-editor-ui-block-rte-type-configuration
@@ -16,39 +18,54 @@ export class UmbPropertyEditorUIBlockRteBlockConfigurationElement
extends UmbLitElement
implements UmbPropertyEditorUiElement
{
- @property({ attribute: false })
- public set value(value: UmbBlockTypeBaseModel[]) {
- this._value = value ?? [];
- }
- public get value() {
- return this._value;
- }
+ #blockTypeWorkspaceModalRegistration?: UmbModalRouteRegistrationController<
+ typeof UMB_WORKSPACE_MODAL.DATA,
+ typeof UMB_WORKSPACE_MODAL.VALUE
+ >;
@state()
- private _value: UmbBlockTypeBaseModel[] = [];
+ private _workspacePath?: string;
+
+ constructor() {
+ super();
+ this.#blockTypeWorkspaceModalRegistration?.destroy();
+
+ this.#blockTypeWorkspaceModalRegistration = new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL)
+ .addAdditionalPath(UMB_BLOCK_RTE_TYPE)
+ .onSetup(() => {
+ return { data: { entityType: UMB_BLOCK_RTE_TYPE, preset: {} }, modal: { size: 'large' } };
+ })
+ .observeRouteBuilder((routeBuilder) => {
+ const newpath = routeBuilder({});
+ this._workspacePath = newpath;
+ });
+ }
+
+ @property({ attribute: false })
+ value: UmbBlockTypeBaseModel[] = [];
@property({ type: Object, attribute: false })
public config?: UmbPropertyEditorConfigCollection;
#onCreate(e: CustomEvent) {
- const key = e.detail.contentElementTypeKey;
- this.value = [...this._value, { contentElementTypeKey: key, forceHideContentEditorInOverlay: false }];
- this.dispatchEvent(new UmbPropertyValueChangeEvent());
+ const selectedElementType = e.detail.contentElementTypeKey;
+ if (selectedElementType) {
+ this.#blockTypeWorkspaceModalRegistration?.open({}, 'create/' + selectedElementType + '/null');
+ }
}
#onChange(e: CustomEvent) {
+ e.stopPropagation();
this.value = (e.target as UmbInputBlockTypeElement).value;
this.dispatchEvent(new UmbPropertyValueChangeEvent());
}
render() {
- return UmbInputBlockTypeElement
- ? html``
- : '';
+ return html``;
}
}