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

Configurable callback when selecting files in Popup #1510

Open
dkoenigroer opened this issue Nov 28, 2024 · 3 comments
Open

Configurable callback when selecting files in Popup #1510

dkoenigroer opened this issue Nov 28, 2024 · 3 comments

Comments

@dkoenigroer
Copy link

We have a CKEditor and someone configured the browser url settings to

"filebrowserBrowseUrl": "/admin/filer/folder/213/list/?_pick=file&_popup=1".

But the Filer expects a FilerField-Target and is only able to return a File-ID.

So a nice feature could be to add a get param with a field name where to put the value in (which is already there but not modifiable) and a field name which value will be returned.

"filebrowserBrowseUrl": "/admin/filer/folder/last/?_pick=file.url&_to_field=%(to_field)s&_return_value=url",

So here we tell the popup tp return the file url instead of the file.id. The _to_field is a placeholder here. i am not sure if the opener winodw knows the field automatically.

@fsbraun
Copy link
Member

fsbraun commented Jan 21, 2025

@dkoenigroer Quickly looking into this, have you considered to create some glue code such as dismissRelatedImageLookupPopup in https://github.com/django-cms/django-filer/blob/master/filer/static/filer/js/addons/popup_handling.js

dismissRelatedImageLookupPopup receives a thumbnail URL at least:

window.dismissRelatedImageLookupPopup = function (
win,
chosenId,
chosenThumbnailUrl,
chosenDescriptionTxt,
chosenAdminChangeUrl
) {

Your code might process the returned values and pass them on to CKEditor.

@fsbraun
Copy link
Member

fsbraun commented Jan 22, 2025 via email

@dkoenigroer
Copy link
Author

I am sorry for my Post and the deletion after. I answered too quickly. The Thumbnail URL has not been returned. The result was the Image URL which has been already in the form field before trying to change via the filer popup. But i will try to override the callback funtion in the admin-base or change_form in order to use the filer result and give feedback.

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