Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picking Media Items via RTE Insert Links, only allows items which are allowed at Media Root #18156

Open
InfiniteSpirals opened this issue Jan 29, 2025 · 4 comments

Comments

@InfiniteSpirals
Copy link

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

Copy link

Hi there @InfiniteSpirals!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@NguyenThuyLan
Copy link
Contributor

Hi @InfiniteSpirals , could you give me more details on line "Remove "File" type from Allow at root"?
I was not able to reproduce it on v15.2.0-rc like this

Umbraco.-.Google.Chrome.2025-02-05.16-09-15.mp4

@InfiniteSpirals
Copy link
Author

Hi @InfiniteSpirals , could you give me more details on line "Remove "File" type from Allow at root"? I was not able to reproduce it on v15.2.0-rc like this

Umbraco.-.Google.Chrome.2025-02-05.16-09-15.mp4

Hi @NguyenThuyLan - thanks for looking at this!

By this I mean, go to Settings, goto the Media type for the media type "File" and under "Structure" uncheck "Allow at root".

Once the type is set to not allow at root, you will see that you can no longer pick this.

umbraco.issue.mp4

Thanks
Chris

@NguyenThuyLan
Copy link
Contributor

Thanks @InfiniteSpirals , now I am able to reproduce it on v15.2.0-rc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants