-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add ability to copy & paste images that are in uploading state. #17327
base: master
Are you sure you want to change the base?
Conversation
After upload is done, will the copied image have |
@arkflpc It's updated to the target, as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@niegowski , wdyt?
@Mati365 We've finished testing the PR with @kubaklatt - it fixes the issue and looks good to us 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you trigger editor.getData()
while an image is not fully uploaded, the editor data would contain the data:
URL. For the user, it would look like the image is successfully uploaded but the URL would not point to the real asset on the server.
The proposed solution restarts the upload after the drop, but we should just keep the uploadId
so the loader can match the given element and continue uploading.
@niegowski we cannot, as it'll be no longer possible to paste such image to another instance of the editor. The second thing is that uploadId will be no longer valid after successful upload of original image, as it's removed from registry to avoid mem leak. |
@juliaflejterska / @charlttsie We changed a bit the behavior of this fix, so large |
Suggested merge commit message (convention)
Fix (image): Copying and pasting images in the uploading state is now possible. Closes #16967
Additional information
It looks like we forgot to dump images that contain
uploadId
to clipboard data. It resulted in blankimg
being exported to the HTML:I added a converter that lookups in file repository and checks if there is matching
uploadId
entry containingdata
. If so, it storesbase64
of loaded image insrc
ofimg
element, which is already pretty well handled later on.Easily reproducible on http://localhost:8125/ckeditor5-image/tests/manual/imageupload.html
Before
before-image-upload-fix-2024-10-25_12.58.54.mp4
After
after-image-upload-fix-2024-10-25_12.55.59.mp4