plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
446 stars 606 forks source link

Allow Image Widget value to be an object in which case we use the '@id' for value of the Image Sidebar preview #6156

Closed ichim-david closed 1 month ago

ichim-david commented 2 months ago

@sneridagh I am not proposing we change the teaser preview_image widget however I was trying as a test bench for the new image widget what would be needed in order to remove the object browser widget and use the new image widget.

Given how the ImageWidget assumes the value is only a string and Teaser/ObjectBrowser always assumes an array of value 1 with an object I think the ImageWidget should be more flexible in displaying the "image preview" by checking the value for the array first result.

Taking the work from https://github.com/plone/volto/pull/6147 these changes would display the external images set as preview_image overrides, any image selected or any image uploaded.

What I would propose is to make the ImageWidget a bit more flexible as seen in the changes made here packages/volto/src/components/manage/Widgets/ImageWidget.jsx

What do you think about my proposal?

netlify[bot] commented 2 months ago

Deploy Preview for plone-components canceled.

Name Link
Latest commit 5a0c3169df2c9c882836a7267548055284ae8377
Latest deploy log https://app.netlify.com/sites/plone-components/deploys/6690c5542956170008f541b6
ichim-david commented 1 month ago

Removed the proof of content code in favor of the proposed fix to the ImageWidget. If anyone wants to try the Teaser block using the ImageWidget you can check out this commit https://github.com/plone/volto/pull/6156/commits/f68545097110dbec32932991d2907ae4d4af398d