-
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
[$500] [Live Markdown] Copying and pasting from google docs comes over as bold #41109
Comments
Triggered auto assignment to @abekkala ( |
Job added to Upwork: https://www.upwork.com/jobs/~0181c168843a4dc29c |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov ( |
@thienlnam Is it okay to prevent all formatting when paste text? |
We'd like to retain the formatting that it was copied with, instead of preventing all formatting at all |
@thienlnam , isn't this the expected behaviour ? If the text was bold on Google docs, we should send it as bold in our chat too. The composer is showing * text * since it's allowing the end user to choose whether they want to continue with the formatting that their copied text used on Google docs or whether they want to change it. In-case they want to change it, they can use markdown (which the composer supports) to change the formatting. |
📣 @jainilparikh! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
@thienlnam
Too much complicated, but simply it is But, As I mentioned in #41110 (comment), this could not be done by regex. Regex has its limitation and could not parse all these complex html. ( I finally find the exact example that regex could not fit for every cases ). Do you think, we can catch css styles using regex? Maybe, Yes. But it is too much complicated. So my proposal is to change the HTML parsing logic like using This way, we can completely resolve the root problem. (cc @jjcoffee ) |
@skyweb331 We could just create DOM subtree for the pasted HTML and then get pure text using the following approach: https://stackoverflow.com/a/6743966/23325954 |
@tomekzaw |
@abekkala, @thienlnam, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Could you put a post in #expensify-open-source about the problem and the solution solved by using another parser so we can get some more eyes on it? |
@thienlnam https://expensify.slack.com/archives/C01GTK53T8Q/p1713721057329569 |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Copying and pasting non-bold text from Google docs gets pasted as bold text. What is the root cause of that problem?Google docs adds some extra HTML values when copying text. Example, when copying
When copying
The font-weight is 400 in the 1st example, while it is 700 in the 2nd. But, in both cases, the outer HTML is wrapped in What changes do you think we should make in order to solve the problem?Update ExpensiMark logic for bold to the below:
If the inner content has If yes, then it uses the bold markdown, else it uses it as a normal text. We can polish the logic and code further. |
@abekkala, @thienlnam, @alitoshmatov Eep! 4 days overdue now. Issues have feelings too... |
Do we need to handle italic as well? I think it's outside the scope of this issue, would like to know thoughts on this. |
@ShridharGoel I think it's fine to only handle the bold case for this particular issue. @alitoshmatov thoughts? |
I agree to handle only bold here cc @alitoshmatov |
Waiting on @alitoshmatov's review Expensify/expensify-common#710 (review) |
@ShridharGoel @alitoshmatov given the PR for expensify-common was merged, I suspect we'd need another PR to bump the package in App, right? |
Yes, will open it in some time. |
Update: PR is in review. |
We can start regression period, other similar PR was quicker then ours and bumped Our changes was in version Line 113 in 6e7852d
|
@abekkala This seems to be due for payments, thanks. |
@thienlnam @marcochavezf I noticed that the PR for this issue was closed without merging based on another PR fixing this issue sooner. Can you confirm if payments are still payable to both contributors here? |
@abekkala yup it's still payable, since the PR that was closed was to bump the version in App, but the main work was done in another PR |
PAYMENT SUMMARY:
|
@alitoshmatov payment sent and contract ended - thank you! 🎉 |
Accepted, thanks. |
@ShridharGoel payment sent and contract ended - thank you! 🎉 |
Actual
![image](https://private-user-images.githubusercontent.com/30609178/326063001-2e97eacc-900e-4d7f-b794-c17650aba3da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzQ0ODMxODMsIm5iZiI6MTczNDQ4Mjg4MywicGF0aCI6Ii8zMDYwOTE3OC8zMjYwNjMwMDEtMmU5N2VhY2MtOTAwZS00ZDdmLWI3OTQtYzE3NjUwYWJhM2RhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVk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_uvqCpThRY)
Expectation
It gets pasted as regular text
cc @tomekzaw
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abekkalaThe text was updated successfully, but these errors were encountered: