volto icon indicating copy to clipboard operation
volto copied to clipboard

Add ImageWidget with upload/drop/external and inline/widget capabilities

Open dobri1408 opened this issue 1 year ago • 9 comments

dobri1408 avatar Jan 09 '24 13:01 dobri1408

Deploy Preview for plone-components canceled.

Name Link
Latest commit dfdabf2618a5bb7660e823ca4f12fa8ead2e9cd4
Latest deploy log https://app.netlify.com/sites/plone-components/deploys/667670c8e9b3650008f3d25f

netlify[bot] avatar Jan 09 '24 13:01 netlify[bot]

Deploy Preview for volto failed.

Name Link
Latest commit 3c44490a731b4e64963b331cd8794babefcd13bd
Latest deploy log https://app.netlify.com/sites/volto/deploys/6628a245b1491900090e2c6c

netlify[bot] avatar Jan 09 '24 13:01 netlify[bot]

I have moved the https://github.com/plone/volto/pull/4142 here, because of the conflicts and the big changes since that pr.

dobri1408 avatar Jan 09 '24 13:01 dobri1408

I have considered that is better to return always the URL of the image because it will be easier for developers to use if it is consistent. What do you think @sneridagh?

dobri1408 avatar Jan 09 '24 19:01 dobri1408

I compared against production docs.

These look the same. Are they supposed to be the same? I'm not sure what I should expect or look for.

  • https://65c09ac45778640008535e9c--volto.netlify.app/storybook/?path=/story/view-widgets-image--image
  • https://6.docs.plone.org/storybook/?path=/story/view-widgets-image--image

The controls appear broken in the Netlify build:

  • https://65c09ac45778640008535e9c--volto.netlify.app/storybook/?path=/story/edit-widgets-object-browser--image

against production:

  • https://6.docs.plone.org/storybook/?path=/story/edit-widgets-object-browser--image

Is the difference expected?

Both have a broken image. Should that be fixed?

Please let me know. Thank you!

stevepiercy avatar Feb 05 '24 10:02 stevepiercy

Hi @stevepiercy, @sneridagh added this for the storybook: https://65c09ac45778640008535e9c--volto.netlify.app/storybook/?path=/story/edit-widgets-image--default, in the old pr, that I have moved here. You can see that shows the Image Widget.

dobri1408 avatar Feb 05 '24 10:02 dobri1408

@dobri1408 nice! Let's get a core contributor to review code.

stevepiercy avatar Feb 05 '24 11:02 stevepiercy

@dobri1408 let's try to push this forward. I just merged, we need to fix the tests. I would also be great that we could address what @tiberiuichim was proposing here as well https://github.com/plone/volto/issues/4286 (the link widget is too much, should happen in another phase, addressed by the other PLIP)

sneridagh avatar Mar 05 '24 08:03 sneridagh

Hello @sneridagh and @davisagli, I've been working on the Image Widget and think it's a good time for a review to ensure it meets the desired requirements and is ready for merging. I've used the same widget for the image block as well.

dobri1408 avatar Apr 17 '24 13:04 dobri1408

@dobri1408 I tested it locally and the test failed in a legit way. If you are going to select an image (or any other object) the UX expects that you start browsing whereever you are now, in this case, inside the document (because it's already created, we are editing it). So this is a legit bug. Could you please take a look?

I have another comment, see below

sneridagh avatar May 31 '24 11:05 sneridagh

@dobri1408 how is this going?

sneridagh avatar Jun 06 '24 13:06 sneridagh

@dobri1408 How is this going? what's the status?

sneridagh avatar Jun 13 '24 10:06 sneridagh

Hi @sneridagh, I've made the changes recommended by @ichim-david and am currently waiting for his review.

dobri1408 avatar Jun 13 '24 10:06 dobri1408

@dobri1408 checking now latest work

ichim-david avatar Jun 16 '24 07:06 ichim-david

@dobri1408 run i18n and commit the change and if necessary update test snapshots. I had to add some aria labels to the AddLinkForm https://github.com/plone/volto/pull/5607/commits/e617d73d5bbe7c3fad9ddd28f7ee55dfd34e34c6 due to them reading "Image button" when using a screen reader

ichim-david avatar Jun 16 '24 09:06 ichim-david

I have added back placeholderLinkInput = '', because there are tests that change the placeholder Link Input

dobri1408 avatar Jun 17 '24 06:06 dobri1408

@sneridagh I've removed the brown important color https://github.com/plone/volto/pull/5607/commits/ec7c2eae37970c6ca7f0cb3fc2707aef2636a670#diff-a584ff5e44089465e761b5e7077bbd875f0b92ed9307db7fea91df1240e76e78L404 from .toolbar-inner .ui.icon.button In doing so the icons from the image widget have opacity changes when focused just like it happens when using other object browser widget blocks such as map or video. Have a look at this video and you will see what I mean

https://github.com/plone/volto/assets/152852/482d0659-84ee-4f16-a7b4-9c61f95517e3

I also had to add this rule https://github.com/plone/volto/pull/5607/commits/ec7c2eae37970c6ca7f0cb3fc2707aef2636a670#diff-cf128453bb126c12a2d763cd1afdbaf4d32ba380bd02702d0393f5ea4c666bb1R30 to avoid having a border looking box shadow when focusing on the primary submit button. Without it since slate-inline-toolbar isn't part of main like our override there it looked like this focus-border

@plone/volto-team this is ready for final review

ichim-david avatar Jun 21 '24 07:06 ichim-david

@sneridagh have another look now regarding the placeholder size when added within a grid and the link popup.

I have one thing that bothers me which is the difference in placeholder svg when we have a grid and we mix teasers and image blocks. You can see this issue in this video:

https://github.com/plone/volto/assets/152852/780480c6-fb1c-4a03-b548-fa04a3964f41

If we remove center then things look better but if we only have teasers then they won't look as balanced on the grid area as when the justify-content was set to center. Given the fact that the grid was made primarily for teasers I leave it as it is however I had to add at least a comment that it bothered me the non-alignment of teaser and image placeholder as changing the current behavior would probably annoy other people thinking why the teasers are no longer centered :)

ichim-david avatar Jun 22 '24 06:06 ichim-david

@ichim-david I see... difficult question :/ indeed removing it will look better overall. It's been long time that I wanted to change that (and remove the semanticUI class from there).

I like https://react-spectrum.adobe.com/react-spectrum/IllustratedMessage.html but I don't see that we are doing anything extraordinary like in there.

sneridagh avatar Jun 22 '24 11:06 sneridagh

@ichim-david I can't agree more. Let's merge this, since it was the original purpose of this PR. @dobri1408 @ichim-david Thanks a lot for the contribution, this is awesome, and very much needed. Merging now.

sneridagh avatar Jun 22 '24 16:06 sneridagh