-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Feature] Support to html pasting on web #4009
Conversation
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.
A couple of nitpicks but it's working well!
const {files, types} = event.clipboardData; | ||
const TEXT_HTML = 'text/html'; | ||
const TEXT_PLAIN = 'text/plain'; | ||
const pastedHTML = event.clipboardData.getData(TEXT_HTML); |
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.
I'd move this inside the types.includes(TEXT_HTML)
check since it's only used in that context
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.
Yes. Thanks
const domparser = new DOMParser(); | ||
const embededImages = domparser.parseFromString(event.clipboardData.getData(TEXT_HTML), TEXT_HTML).images; | ||
const pastedText = event.clipboardData.getData(TEXT_PLAIN); | ||
const embededImages = domparser.parseFromString(pastedHTML, TEXT_HTML).images; |
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.
const embededImages = domparser.parseFromString(pastedHTML, TEXT_HTML).images; | |
const embeddedImages = domparser.parseFromString(pastedHTML, TEXT_HTML).images; |
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.
Yup. It was already there but I will update.
@Jag96 While handling all this I found a couple of issues.
Do you suggest they need solving and if so, How can I help? |
Updated. |
Good finds!
Thoughts? |
Ok. I agree. Should I add those fixes in this PR? |
I think fixes for 1 and 2 should be added to this PR, assuming 2 requires a fix. |
@Jag96 Just opened a new PR for |
Okay, I have updated the E-common here. and |
Please let me know if anything else is needed here. |
1 looks good, for 2 it looks like when I copy HTML that contains a Results in the following
Before this PR, pasting the content would include these line breaks, but now it strips them:
However, this just looks like a bug in the regex and isn't really tied to the core of this PR, so I won't block on it and I'll open a new issue for this. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Yeah @Jag96 Do you want me to correct the Br tag regex |
🚀 Deployed to staging in version: 1.0.77-6🚀
|
@parasharrajat sounds good, feel free to leave a comment on #4052 so I can assign you, I'll invite you to the Upwork job in the meantime |
No worries! Now that #4067 is on staging that'll be the latest fix |
🚀 Deployed to production in version: 1.0.79-4🚀
|
An error was identified that was linked to this PR - #9505 |
Details
Fixed Issues
$ Fixes #3790
Tests | QA Steps
Bold text
italic text
Strikethrough textTested On
Screenshots
Web | Desktop
paste-w.mp4
Mobile Web
iOS
Android