plone / volto

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

Teaser block image override doesn't render external images #6137

Closed ichim-david closed 2 weeks ago

ichim-david commented 2 months ago

Describe the bug Teaser allows external links for "Image override" however they do not render upon inserting these image links.

To Reproduce Go to https://light-theme.kitconcept.io/ since this is the only volto 18 test deployment and add a teaser, select Customize teaser content and insert any external images. Same behavior is seen with Volto 17 https://volto.demo.plone.org/

Expected behavior The image should be used for the teaser header image.

Screenshots teaser-image-not-rendering

Tishasoumya-02 commented 2 months ago

By adding a new attribute 'src' or 'url' in object_browser widget, we can refer to the link in the restapi and while rendering the Image in teaser block we can use ternary conditions .

I'll link this issue to the PR for better understanding

ichim-david commented 2 months ago

By adding a new attribute 'src' or 'url' in object_browser widget, we can refer to the link in the restapi and while rendering the Image in teaser block we can use ternary conditions .

I'll link this issue to the PR for better understanding

@Tishasoumya-02 I think you are going about this the wrong way. It has todo with the preview_image and from the teaser you need to check if the value is internal if so flatten to url or simply serve it as is. Look at the block data information and you will see that the external url is added in the first element of the preview_image preview_image

nileshgulia1 commented 2 months ago

It would be ideal to check or make that objectBrowserWidget accept externalUrls using a prop. https://github.com/plone/volto/blob/51bdfa0bd4d1b3b726855da0a0e6ad2880271b29/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.jsx#L367

ichim-david commented 2 months ago

It would be ideal to check or make that objectBrowserWidget accept externalUrls using a prop.

https://github.com/plone/volto/blob/51bdfa0bd4d1b3b726855da0a0e6ad2880271b29/packages/volto/src/components/manage/Widgets/ObjectBrowserWidget.jsx#L367

@nileshgulia1 I don't understand what you mean, there is already support for passing allowExternals as seen here https://github.com/plone/volto/blob/main/packages/volto/src/components/manage/Blocks/Teaser/schema.js#L101 this is part of the problem of this ticket that you can add an external image but it's not used by the teaser to render it