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

Fixes for Image widget #6151

Merged
merged 19 commits into from
Jul 4, 2024
Merged

Fixes for Image widget #6151

merged 19 commits into from
Jul 4, 2024

Conversation

ichim-david
Copy link
Member

@ichim-david ichim-david commented Jul 3, 2024

Fixes #6149

…he container of the trigger button instead of body

- This way we don't have problems with position when used
  within the sidebar for fields of blocks
- it's no point in adding it since it will result in duplicated id's
  due to this widget being used in more than one context
Copy link

netlify bot commented Jul 3, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit e989b33
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/66869e0fa20c3a0009f3ba3f

@ichim-david
Copy link
Member Author

@sneridagh not done yet, still some cleanup and test failures but this is my result so far

image-widget-relative.mp4

@sneridagh
Copy link
Member

Let's talk tomorrow and try to merge both PRs on the image widget.

ichim-david and others added 8 commits July 3, 2024 21:19
…slate

- After modification made in e5dd823
  link button no longer appeared since it wasn't called with setting
  objectBrowserPickerType which we now add as a default prop.
  This way it shows up in slate link popup and not within the image widget which
  correctly passes this prop
…tyles cross browser

- In edge the toolbar was a lot smaller than the input area as opposed to FF or Safari
…duplicated css and avoid the sidebar left override.
@ichim-david
Copy link
Member Author

ichim-david commented Jul 4, 2024

I took the fix from @sneridagh regarding the image upload bug but left out he css changes since I have modified the ImageWidget to make the label for FormFieldWrapper and by adding class block to the image-widget-upload we got the styling without need for style duplication.

Here is how the image widget behaves on the image and on a content that might use it, in my demo I appied it to the teaser but you could add it to something else.
Tested in Safari, Firefox and Chrome (suprisingly chrome has some issues with the width of the input which is why I had to add some extra widths statements :( )

image-widget.mp4

And here is the Link plugin button showing back to the Slate toolbar add link

link-widget.mp4

EDIT:
I had to remove the always computing position of the link popup since it was moving around as you've scrolled.
Instead you can pass position to LinkEditor like you could to the PositionedToolbar from slate otherwise it uses a default that places it above the area of the trigger button.

link-popup-position.mp4

Copy link
Member

@sneridagh sneridagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @ichim-david for being so thorough, amazing work!

@sneridagh sneridagh changed the title 6149 image widget fixes Fixes for Image widget Jul 4, 2024
- in Safari we got a small shift in sidebar widget at 82%
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to use one line per sentence in the change logs. It gets rendered as HTML, so we don't care about line wraps at 80 (or whatever) characters.

@@ -0,0 +1,7 @@
Use unused `toggleButton` prop in `PositionedToolbar` to render the
toolbar in a different portal target falling back to document.body
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
toolbar in a different portal target falling back to document.body
toolbar in a different portal target falling back to `document.body`

toolbar in a different portal target falling back to document.body
if `toggleButton` is not provided. @ichim-david

When `toggleButton` is provided as portal target, we allow negative
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When `toggleButton` is provided as portal target, we allow negative
When `toggleButton` is provided as portal target, allow negative

if `toggleButton` is not provided. @ichim-david

When `toggleButton` is provided as portal target, we allow negative
left positioning but not when target is body to avoid the toolbar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
left positioning but not when target is body to avoid the toolbar
left positioning except when the target is `body` to prevent the toolbar


When `toggleButton` is provided as portal target, we allow negative
left positioning but not when target is body to avoid the toolbar
going off screen and avoiding breaking changes. @ichim-david
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
going off screen and avoiding breaking changes. @ichim-david
going off screen and avoid breaking changes. @ichim-david

@@ -0,0 +1,4 @@
Fixed image widget position and look and feel in sidebar @ichim-david
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fixed image widget position and look and feel in sidebar @ichim-david
Fixed image widget position and look and feel in sidebar. @ichim-david

Fixed image widget position and look and feel in sidebar @ichim-david

Breaking:
- This change updated the markup of the widget in the generated form both in sidebar and in a normal form.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a process that needs to be added to the upgrade guide?

What should developers search for and change, if needed?

In which file should they search for details?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a process that needs to be added to the upgrade guide?

What should developers search for and change, if needed?

In which file should they search for details?

@stevepiercy I modified the text with some information on what changed.
It has todo with the image widget added ast part of Volto 18 alpha 35 or 36
#5607
We found some bugs that needed fixing. I don't know if we need such breaking
for breaking changes, from my point of view being in alpha means that we can
make a fix that changes things added in a preview alpha if we found problems with
the work that we approved and merged then.

If you think otherwise and still need further info added get in touch with me and lets
finish the info as needed.

Copy link
Member

@sneridagh sneridagh Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevepiercy @ichim-david Since it's a breaking of a breaking and it's about markup, it's fine, to my understanding no need yet another entry for something that unlikely someone has already customized. We only did that in case an API changing, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that sounds good, just wanted to make sure that breaking is OK in this context.

@sneridagh sneridagh merged commit 8147643 into main Jul 4, 2024
70 checks passed
@sneridagh sneridagh deleted the 6149_image_widget_fixes branch July 4, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image widget size when used in sidebar and editor link position when scrolling
3 participants