Skip to content

fix: Sized image dimensions are lost upon page reload (image shows up again as 100% full width) 🤖 #1158

Open
mrjbj wants to merge 2 commits intoHiEventsDev:developfrom
mrjbj:fix/image-resize-extension-name
Open

fix: Sized image dimensions are lost upon page reload (image shows up again as 100% full width) 🤖 #1158
mrjbj wants to merge 2 commits intoHiEventsDev:developfrom
mrjbj:fix/image-resize-extension-name

Conversation

@mrjbj
Copy link
Copy Markdown

@mrjbj mrjbj commented Apr 11, 2026

Body:

What changes I've made

  • Renamed ImageResize extension from 'imageResize' to 'image' so it fully replaces the base TipTap Image extension
  • Removed the redundant base Image extension registration from the Editor

Why I've made these changes

Resized image dimensions are lost on save/reload. Both the base Image (name: 'image') and ImageResize (name: 'imageResize') extensions were registered simultaneously. When TipTap parses saved HTML, it matches <img> tags to the 'image' node type — the base extension, which doesn't persist the style attribute. By renaming ImageResize to 'image' and removing the base, the resize-aware extension fully owns <img> parsing and preserves dimensions.

How I've tested these changes

  • Inserted an image in the editor, resized it via drag handles
  • Saved, navigated away (including to different page), returned — image retained its resized dimensions
  • Verified resize handles still appear and function correctly
  • Confirmed new images default to 100% width as expected

Checklist

ImageResize had name 'imageResize' while base Image (name 'image') was also
registered. TipTap parsed <img> tags with the base extension, which lacks
renderHTML for style, so resized dimensions were lost on save/reload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mrjbj mrjbj changed the title fix: Sized image dimensions are lost upon page reload (image shows up again as 100% full width) fix: Sized image dimensions are lost upon page reload (image shows up again as 100% full width) 🤖 Apr 13, 2026
Without renderHTML, resized image dimensions are only stored in parseHTML
but not serialized back to the document, causing them to be lost on reload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant