plone / volto

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

Image block edit should reuse the image block view component #4835

Open tiberiuichim opened 11 months ago

tiberiuichim commented 11 months ago

https://github.com/plone/volto/blob/9c5b4ccf94281e2849ca9b66e74cafe7f5ef87cb/src/components/manage/Blocks/Image/View.jsx#L21-L41

https://github.com/plone/volto/blob/9c5b4ccf94281e2849ca9b66e74cafe7f5ef87cb/src/components/manage/Blocks/Image/Edit.jsx#L244-L260

The logic is doubled, it's "impossible" to customize the rendering of the Image block and have it also reproduced in the edit mode.

davisagli commented 11 months ago

@tiberiuichim https://github.com/plone/volto/pull/3337 will change both the Edit and View components of the image block to use a custom Image component which can be customized. Does that meet your needs?

ichim-david commented 4 months ago

@davisagli If we look at 17.x.x https://github.com/plone/volto/blob/17.x.x/src/components/manage/Blocks/Image/View.jsx#L34 and https://github.com/plone/volto/blob/17.x.x/src/components/manage/Blocks/Image/Edit.jsx#L267 The whole Image rendering logic is duplicated both in Edit and View. Ideally, this render logic would be refactored so that if you make a change to the rendering it it propagates to both views