ckeditor5
ckeditor5 copied to clipboard
Pasted image should be a block image by default
Scenario:
- Type something
- Paste an image
- Press Enter to keep typing in a new line below the image:
WAT? Where's my image?
https://user-images.githubusercontent.com/156149/178748475-ed2c23d5-65da-4533-becb-378dca69218a.mp4
So, what happened is that despite how it looked, this image was pasted as an inline image and got selected. It didn't look like an inline image cause it was huge. So I pressed Enter to start typing below the image (this is how it worked before we introduced inline images and how it works e.g. in Notion). But then – boom :boom: Image is lost.
It took me a minute to figure out what's happening. I strongly believe that in a huge majority of cases, block images are the way to go. But the absolute minimum is to fix the heuristic so pasting at the end of line gets you a block image.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
BTW, inline images in GitHub Writer makes nearly zero sense. I'll report an issue about this too because I think that at least for now, before we'll polish the UX it made no sense to enable inline images there.
Scope: Just do minimal thing (... is to fix the heuristic so pasting at the end of line gets you a block image).
The place with heuristic: https://github.com/ckeditor/ckeditor5/blob/e86c4029b1b4ea184f2451f23b24ce603afead55/packages/ckeditor5-image/src/image/utils.js#L109-L125
I ran into this again when trying to force an integration with Strapi's media library to insert images as block images. Since it relies on toView() -> toModel() -> insertContent(), I have no control over this. Probably it's be the same if I relied on the insert image command, but relying on the former makes it easier to handle image replacement.
👆 For the ref: https://github.com/ckeditor/strapi-plugin-ckeditor/pull/14
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
Duplicate: #15158.