diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts index 2335d0d301..91442a0e4b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-grid/context/block-grid-entries.context.ts @@ -16,10 +16,8 @@ import { UmbStringState, } from '@umbraco-cms/backoffice/observable-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import { pathFolderName } from '@umbraco-cms/backoffice/utils'; +import { UmbModalRouteRegistrationController, UmbRoutePathAddendumContext } from '@umbraco-cms/backoffice/router'; import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models'; -import { UMB_CONTENT_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/content'; interface UmbBlockGridAreaTypeInvalidRuleType { groupKey?: string; @@ -40,11 +38,7 @@ export class UmbBlockGridEntriesContext implements UmbBlockGridScalableContainerContext { // - #catalogueModal: UmbModalRouteRegistrationController< - typeof UMB_BLOCK_CATALOGUE_MODAL.DATA, - typeof UMB_BLOCK_CATALOGUE_MODAL.VALUE - >; - #workspaceModal; + #pathAddendum = new UmbRoutePathAddendumContext(this); #parentEntry?: typeof UMB_BLOCK_GRID_ENTRY_CONTEXT.TYPE; @@ -94,9 +88,6 @@ export class UmbBlockGridEntriesContext setParentUnique(contentKey: string | null) { this.#parentUnique = contentKey; - // Notice pathFolderName can be removed when we have switched to use a proper GUID/ID/KEY. [NL] - this.#workspaceModal.setUniquePathValue('parentUnique', pathFolderName(contentKey ?? 'null')); - this.#catalogueModal.setUniquePathValue('parentUnique', pathFolderName(contentKey ?? 'null')); } getParentUnique(): string | null | undefined { @@ -105,8 +96,7 @@ export class UmbBlockGridEntriesContext setAreaKey(areaKey: string | null) { this.#areaKey = areaKey; - this.#workspaceModal.setUniquePathValue('areaKey', areaKey ?? 'null'); - this.#catalogueModal.setUniquePathValue('areaKey', areaKey ?? 'null'); + this.#pathAddendum.setAddendum(areaKey ?? ''); this.#gotAreaKey(); // Idea: If we need to parse down a validation data path to target the specific layout object: [NL] @@ -153,9 +143,8 @@ export class UmbBlockGridEntriesContext this.#gotBlockParentEntry(); // is not used at this point. [NL] }); - this.#catalogueModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId', 'parentUnique', 'areaKey']) - .addAdditionalPath(':view/:index') + new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) + .addAdditionalPath('_catalogue/:view/:index') .onSetup((routingInfo) => { if (!this._manager) return false; // Idea: Maybe on setup should be async, so it can retrieve the values when needed? [NL] @@ -199,8 +188,7 @@ export class UmbBlockGridEntriesContext this._catalogueRouteBuilderState.setValue(routeBuilder); }); - this.#workspaceModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_GRID_WORKSPACE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId', 'parentUnique', 'areaKey']) + new UmbModalRouteRegistrationController(this, UMB_BLOCK_GRID_WORKSPACE_MODAL) .addAdditionalPath('block') .onSetup(() => { return { @@ -221,12 +209,6 @@ export class UmbBlockGridEntriesContext const newPath = routeBuilder({}); this._workspacePath.setValue(newPath); }); - - this.consumeContext(UMB_CONTENT_PROPERTY_DATASET_CONTEXT, (dataset) => { - const variantId = dataset.getVariantId(); - this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString()); - this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString()); - }); } protected _gotBlockManager() { @@ -234,15 +216,6 @@ export class UmbBlockGridEntriesContext this.#setupAllowedBlockTypes(); this.#setupRangeLimits(); - - this.observe( - this._manager.propertyAlias, - (alias) => { - this.#catalogueModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - this.#workspaceModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - }, - 'observePropertyAlias', - ); } #gotAreaKey() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts index a69476c174..1e5604a48c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/context/block-list-entries.context.ts @@ -7,7 +7,6 @@ import { UMB_BLOCK_LIST_MANAGER_CONTEXT } from './block-list-manager.context-tok import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import { UMB_CONTENT_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/content'; export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< typeof UMB_BLOCK_LIST_MANAGER_CONTEXT, @@ -17,11 +16,6 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< UmbBlockListWorkspaceOriginData > { // - #catalogueModal: UmbModalRouteRegistrationController< - typeof UMB_BLOCK_CATALOGUE_MODAL.DATA, - typeof UMB_BLOCK_CATALOGUE_MODAL.VALUE - >; - #workspaceModal; // We will just say its always allowed for list for now: [NL] public readonly canCreate = new UmbBooleanState(true).asObservable(); @@ -29,9 +23,8 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< constructor(host: UmbControllerHost) { super(host, UMB_BLOCK_LIST_MANAGER_CONTEXT); - this.#catalogueModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId']) - .addAdditionalPath(':view/:index') + new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) + .addAdditionalPath('_catalogue/:view/:index') .onSetup(async (routingInfo) => { await this._retrieveManager; if (!this._manager) return false; @@ -69,8 +62,7 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< this._catalogueRouteBuilderState.setValue(routeBuilder); }); - this.#workspaceModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_LIST_WORKSPACE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId']) + new UmbModalRouteRegistrationController(this, UMB_BLOCK_LIST_WORKSPACE_MODAL) .addAdditionalPath('block') .onSetup(() => { return { @@ -82,13 +74,6 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< const newPath = routeBuilder({}); this._workspacePath.setValue(newPath); }); - - // TODO: This must later be switched out with a smarter Modal Registration System, cause here is a issue with Block Editors in inline mode in Block Editors, cause the hosting Block is also of type Content. [NL] - this.consumeContext(UMB_CONTENT_PROPERTY_DATASET_CONTEXT, (dataset) => { - const variantId = dataset.getVariantId(); - this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString()); - this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString()); - }); } protected _gotBlockManager() { @@ -108,15 +93,6 @@ export class UmbBlockListEntriesContext extends UmbBlockEntriesContext< }, 'observeThisLayouts', ); - - this.observe( - this._manager.propertyAlias, - (alias) => { - this.#catalogueModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - this.#workspaceModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - }, - 'observePropertyAlias', - ); } getPathForCreateBlock(index: number) { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/context/block-rte-entries.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/context/block-rte-entries.context.ts index 343c009ccf..3f29d65388 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/context/block-rte-entries.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/context/block-rte-entries.context.ts @@ -9,7 +9,6 @@ import { UMB_BLOCK_RTE_MANAGER_CONTEXT } from './block-rte-manager.context-token import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router'; -import { UMB_CONTENT_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/content'; export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< typeof UMB_BLOCK_RTE_MANAGER_CONTEXT, @@ -19,11 +18,6 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< UmbBlockRteWorkspaceOriginData > { // - readonly #catalogueModal: UmbModalRouteRegistrationController< - typeof UMB_BLOCK_CATALOGUE_MODAL.DATA, - typeof UMB_BLOCK_CATALOGUE_MODAL.VALUE - >; - readonly #workspaceModal; // We will just say its always allowed for RTE for now: [NL] public readonly canCreate = new UmbBooleanState(true).asObservable(); @@ -31,9 +25,8 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< constructor(host: UmbControllerHost) { super(host, UMB_BLOCK_RTE_MANAGER_CONTEXT); - this.#catalogueModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId']) - .addAdditionalPath(':view') + new UmbModalRouteRegistrationController(this, UMB_BLOCK_CATALOGUE_MODAL) + .addAdditionalPath('_catalogue/:view') .onSetup((routingInfo) => { return { data: { @@ -68,8 +61,7 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< this._catalogueRouteBuilderState.setValue(routeBuilder); }); - this.#workspaceModal = new UmbModalRouteRegistrationController(this, UMB_BLOCK_RTE_WORKSPACE_MODAL) - .addUniquePaths(['propertyAlias', 'variantId']) + new UmbModalRouteRegistrationController(this, UMB_BLOCK_RTE_WORKSPACE_MODAL) .addAdditionalPath('block') .onSetup(() => { return { data: { entityType: 'block', preset: {}, baseDataPath: this._dataPath }, modal: { size: 'medium' } }; @@ -78,12 +70,6 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< const newPath = routeBuilder({}); this._workspacePath.setValue(newPath); }); - - this.consumeContext(UMB_CONTENT_PROPERTY_DATASET_CONTEXT, (dataset) => { - const variantId = dataset.getVariantId(); - this.#catalogueModal.setUniquePathValue('variantId', variantId?.toString()); - this.#workspaceModal.setUniquePathValue('variantId', variantId?.toString()); - }); } protected _gotBlockManager() { @@ -103,15 +89,6 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext< }, 'observeThisLayouts', ); - - this.observe( - this._manager.propertyAlias, - (alias) => { - this.#catalogueModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - this.#workspaceModal.setUniquePathValue('propertyAlias', alias ?? 'null'); - }, - 'observePropertyAlias', - ); } getPathForCreateBlock() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts index 2c6380be9f..3854cea921 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-type/components/input-block-type/input-block-type.element.ts @@ -39,7 +39,6 @@ export class UmbInputBlockTypeElement< this.dispatchEvent(new CustomEvent('change', { detail: { moveComplete: true } })); }, }); - #elementPickerModal; @property({ type: Array, attribute: false }) public set value(items) { @@ -50,9 +49,10 @@ export class UmbInputBlockTypeElement< return this._items; } + /** @deprecated will be removed in v17 */ @property({ type: String }) public set propertyAlias(value: string | undefined) { - this.#elementPickerModal.setUniquePathValue('propertyAlias', value); + //this.#elementPickerModal.setUniquePathValue('propertyAlias', value); } public get propertyAlias(): string | undefined { return undefined; @@ -75,13 +75,16 @@ export class UmbInputBlockTypeElement< super(); this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, async (instance) => { this.#datasetContext = instance; - this.observe(await this.#datasetContext?.propertyValueByAlias('blocks'), (value) => { - this.#filter = value as Array; - }); + this.observe( + await this.#datasetContext?.propertyValueByAlias('blocks'), + (value) => { + this.#filter = value as Array; + }, + 'observeBlocks', + ); }); - this.#elementPickerModal = new UmbModalRouteRegistrationController(this, UMB_DOCUMENT_TYPE_PICKER_MODAL) - .addUniquePaths(['propertyAlias']) + new UmbModalRouteRegistrationController(this, UMB_DOCUMENT_TYPE_PICKER_MODAL) .onSetup(() => { return { data: { diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/context/block-entry.context.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/context/block-entry.context.ts index 11fa3c7b1f..686d52f3a0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/context/block-entry.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/context/block-entry.context.ts @@ -24,6 +24,7 @@ import type { Observable } from '@umbraco-cms/backoffice/external/rxjs'; import type { UmbBlockTypeBaseModel } from '@umbraco-cms/backoffice/block-type'; import { UmbVariantId } from '@umbraco-cms/backoffice/variant'; import { UmbUfmVirtualRenderController } from '@umbraco-cms/backoffice/ufm'; +import { UmbRoutePathAddendumContext } from '@umbraco-cms/backoffice/router'; export abstract class UmbBlockEntryContext< BlockManagerContextTokenType extends UmbContextToken, @@ -45,6 +46,8 @@ export abstract class UmbBlockEntryContext< _entries?: BlockEntriesContextType; #contentKey?: string; + + #pathAddendum = new UmbRoutePathAddendumContext(this); #variantId = new UmbClassState(undefined); protected readonly _variantId = this.#variantId.asObservable(); @@ -275,6 +278,7 @@ export abstract class UmbBlockEntryContext< this.observe( this.unique, (contentKey) => { + this.#pathAddendum.setAddendum(contentKey); if (!contentKey) return; this.#observeContentData(); }, diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-rich-media/input-rich-media.element.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-rich-media/input-rich-media.element.ts index 26bb6ce7b7..efa2e06e9d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-rich-media/input-rich-media.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-rich-media/input-rich-media.element.ts @@ -133,19 +133,21 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement, #focalPointEnabled: boolean = false; @property() + /** @deprecated will be removed in v17 */ public set alias(value: string | undefined) { - this.#modalRouter.setUniquePathValue('propertyAlias', value); + //this.#modalRouter.setUniquePathValue('propertyAlias', value); } public get alias(): string | undefined { - return this.#modalRouter.getUniquePathValue('propertyAlias'); + return undefined; //this.#modalRouter.getUniquePathValue('propertyAlias'); } @property() + /** @deprecated will be removed in v17 */ public set variantId(value: string | UmbVariantId | undefined) { - this.#modalRouter.setUniquePathValue('variantId', value?.toString()); + //this.#modalRouter.setUniquePathValue('variantId', value?.toString()); } public get variantId(): string | undefined { - return this.#modalRouter.getUniquePathValue('variantId'); + return undefined; //this.#modalRouter.getUniquePathValue('variantId'); } /** @@ -177,7 +179,6 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement, #itemRepository = new UmbMediaItemRepository(this); - #modalRouter; #modalManager?: UmbModalManagerContext; constructor() { @@ -187,9 +188,8 @@ export class UmbInputRichMediaElement extends UUIFormControlMixin(UmbLitElement, this.#modalManager = instance; }); - this.#modalRouter = new UmbModalRouteRegistrationController(this, UMB_IMAGE_CROPPER_EDITOR_MODAL) + new UmbModalRouteRegistrationController(this, UMB_IMAGE_CROPPER_EDITOR_MODAL) .addAdditionalPath(':key') - .addUniquePaths(['propertyAlias', 'variantId']) .onSetup((params) => { const key = params.key; if (!key) return false;