Description
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
15.1, 15.2rc
Bug summary
Picking Media Items via RTE Insert Links, only allows items which are allowed at Media Root.
It seems the problem stems from the fact that in the the Lit component 'media-picker-modal-component.ts' call this_selectableFilter
#renderCard(item: UmbMediaTreeItemModel | UmbMediaSearchItemModel) { const canNavigate = this.#allowNavigateToMedia(item); const selectable = this._selectableFilter(item);
Which in turn calls this private function within input-media.element.ts'
#pickableFilter = (item: UmbMediaItemModel): boolean => { if (this.allowedContentTypeIds && this.allowedContentTypeIds.length > 0) { return this.allowedContentTypeIds.includes(item.mediaType.unique); } return true; };
In this case, this.allowedContentTypeIds is whatever is allowed at media root, as the call to the api method passes "null" not the id of the type of the parent folder. This happens in link-picker-modal.element.ts
// Get all the media types, excluding the folders, so that files are selectable media items. const mediaTypeStructureRepository = new UmbMediaTypeStructureRepository(this); const { data: mediaTypes } = await mediaTypeStructureRepository.requestAllowedChildrenOf(null); this._allowedMediaTypeUniques = (mediaTypes?.items.map((x) => x.unique).filter((x) => x && !isUmbracoFolder(x)) as Array<string>) ?? []; }
So, you can only pick types allowed at root.
Specifics
No response
Steps to reproduce
In a fresh install, add an RTE to a doctype.
Remove "File" type from Allow at root
Create a media folder, and create a child file underneath this
Create a doctype in Content of type created in step 1.
In the RTE, go to insert a link, choose media
Navigate to the file in the folder. It's disabled and cannot be picked
Expected result / actual result
This should update the allowed items based on those that are allowed by the folders that are selected as you navigate down the tree