-
Notifications
You must be signed in to change notification settings - Fork 18
Support for pasting images #28
Conversation
…tation when pasting from Word.
…ss entire plugin.
Pull Request Test Coverage Report for Build 148
💛 - Coveralls |
Ready for review 🎉 |
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.
Everything works fine 👌
Make sure that, if the image upload adapter is provided, no base64 data will be inserted in the model. In would break collaboration. Also, ensure that the upload progress displays properly on other collaboration clients (or report a follow-up about it if there is any problem with it). |
I have removed logic responsible for blob extraction (moving it to |
Just to clarify the previous comment. Moving blob extraction to |
This PR contains also some additional space normalization which apparently solves #39 and #40, I have added to |
Haha :D While checking the code I thought... shouldn't it fix the issue that @f1ames just reported? :D |
I've done some testing and it works as expected. I'm going to have a quick look at the code still (especially in ckeditor/ckeditor5-image#248) but we should be able to merge this very soon. |
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.
Comments.
Suggested merge commit message (convention)
Feature: Support for pasting content with images from Word. Closes ckeditor/ckeditor5#2515. Closes ckeditor/ckeditor5#2529. Closes ckeditor/ckeditor5#2534.
Additional information
This PR implements two mechanisms - one for handling images in Chrome, Firefox and Edge and one for handling images in Safari.
Chrome, Firefox, Edge
When content is pasted from Word, images are represented wit local sources
file://
. In the browser clipboard apart fromtext/html
data, there istext/rtf
data provided which contains entire images encoded as hex strings. These strings are extracted, converted tobase64
and used as new image elements sources e.g<img src="data:image/jpeg;base64,..." >
.This is a synchronous process so all content manipulation takes place on a view instance so data inserted on paste is in its final form (no transformations are applied after data is rendered in the editor).
Safari
When content is pasted from Word, images are represented with local blob resource
blob://
. Such resources are then fetched (viaXHR
), converted tobase64
representation and then used as new image elements sources e.g<img src="data:image/jpeg;base64,..." >
.As fetching blobs is an asynchronous process, first the data with blobs is inserted into the editor (images are already visible) and then when each blob is fetched and converted, images sources are replaced.
Note: As this PR was built on top of
t/12
(as it provides whole infrastructure for automatic testing on Safari), it can be merged only after #16 (t/12
PR) is merged.