Skip to content

Format Library: Ensure inline image with updates persist after removing the 'width' #69683

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

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

Sourav61
Copy link
Contributor

@Sourav61 Sourav61 commented Mar 24, 2025

What?

Closes #69678

This PR ensures that the inline image width persists correctly when updated via the width popover. Previously, removing the width caused the style attribute to be lost, preventing future updates from applying correctly.

Why?

When the width was removed and applied, the style attribute was cleared. Subsequent updates to width did not restore the style, leading to a persistent issue where the width couldn't be reapplied.

How?

  • Ensured style is correctly updated in onSubmit.
  • Used the previous style value when width is empty instead of removing the attribute.
  • Verified onChange is triggered properly with the new attributes.

Testing Instructions

  1. Open a post or page in the editor.
  2. Insert an inline image.
  3. Open the width popover, remove the width, and click "Apply."
  4. Refresh the page and verify the image no longer has a width.
  5. Reopen the popover, enter a new width, and click "Apply."
  6. Confirm that the width persists and updates correctly.

Screenshots or screencast

inline-image-style-update-issue.mp4

…the style attribute

Ensure inline image width updates persist by correctly handling the style attribute
@Sourav61 Sourav61 requested a review from ellatrix as a code owner March 24, 2025 17:33
Copy link

github-actions bot commented Mar 24, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Sourav61 <sourav08@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: Alexus450 <alexus450@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Package] Format library /packages/format-library labels Mar 24, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thank you, @Sourav61!

@Mamaduka Mamaduka added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Mar 24, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Mar 24, 2025
@Mamaduka Mamaduka changed the title Fix: Ensure inline image width updates persist by correctly handling the style attribute Format Library: Ensure inline image with updates persist after removing the 'width' Mar 24, 2025
@Mamaduka Mamaduka merged commit 571dc10 into WordPress:trunk Mar 24, 2025
69 of 71 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.6 milestone Mar 24, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…ng the 'width' (WordPress#69683)

Ensure inline image width updates persist by correctly handling the style attribute

Co-authored-by: Sourav61 <sourav08@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: Alexus450 <alexus450@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Format library /packages/format-library [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A bug with the popup editor for inline images in the paragraph block
2 participants