-
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
Edit comment - Spaces are not displayed in edit box #2847
Comments
Triggered auto assignment to @zanyrenney ( |
Triggered auto assignment to @stitesExpensify ( |
@roryabraham this can probably be external unless you're working on it already, right? |
Yep I'm not working on this, so let's get this on Upwork! |
Triggered auto assignment to @NicMendonca ( |
Created job in Upwork: https://www.upwork.com/jobs/~01aab2d470107fe14c |
Triggered auto assignment to @marcaaron ( |
Proposal 📄Spaces should be visible in edit comment box Investigation 🕵🏻♂️
htmlForNewComment.replace(/<[^>]*>?/gm, '') Approach 👨🏼💻File of concern :
Discussion with the team might be required to pick the best possible approach Best Practices 💃🏼
Testing Strategy 🧪
Expected Delivery Time 📦Approx 1-3 days. Previous Experience 🙅🏼♂️ |
@pranshuchittora The regex you're referring to actually lives here. It's not that it "doesn't work" per-se. It does exactly what it intends to – strips HTML tags from a string. However, we will need to investigate the full context of why we have separate reportAction fields for text v.s. html. I believe it has to do with preventing XSS attacks, but I'm really not sure cc @yuwenmemon @tgolen do you know why we chose to do have separate reportAction values for the message text & html? Without knowing the full answer to that question – I think the better of your two proposed approaches might be So a better long-term solution will probably be to build a custom input that can enable us to display and easily edit certain HTML like text. Similar to how Slack works. But I think that would be a bold undertaking and would require a broader conversation. Yet another alternate solution would be to store not only the transformed html of a message, but also the markdown that the user wrote to generate that html. Then we could display that markdown string (always plain text) in the compose box and allow the user to edit that. That might help us achieve a UX more similar to GitHub than Slack. Thoughts? |
@roryabraham I truly agree with you. As per my experience regexes doesn’t scale well in terms of maintainability in the long run. Considering the budget for this fix, the possible way is to replace the HTML string sanitization with native sanatizer In the long run, I prefer the HTML way as mentioned in the above comment. But it totally depends on the budget for this ticket. If possible then I would love to implement this :) |
DetailsIf we turn this line into this: However, there's one more problem in editing the message that new message doesn't use Proposal
|
ProposalWe modify getActionText() in /src/pages/home/report/ReportActionContextMenu.js
|
@roryabraham I believe the text field is for exactly this:
It also is useful for contexts where we can use HTML (like push notifications), but I think if we're not using the |
Ok based on the conversations in Slack I think that how we should handle this is:
const parser = new ExpensiMark();
const markdownTextForEditor = parser.HTMLtoMarkdown(/* html string */)
|
Also, it might be fine for this work to be split up into several issues - but we can start by handling the line breaks at least? |
This is pretty much just waiting on a contributor to raise their ✋ and agree to do this @pranshuchittora thoughts? |
Hi, @marcaaron pardon the delayed reply.
|
Let me elaborate
Example 👇🏼
<a href="https://expensify.cash/">Expensify</a>
[Expensify](https://expensify.cash/) |
@pranshuchittora That looks correct to me! Generally speaking, we try to match GitHub-flavored markdown. |
@roryabraham& @marcaaron I think #2965 is related to this. If we fix #2965 now then we need to fix it again as we are deprecating |
@pranshuchittora AFAIK that is a different issue. We would want to show the text as the last message text preview in LHN. This issue requires converting Html to MD and vice-versa as while editing a message, it would be best if the user can see the original message created(in MD). We would drop the text from storage and Create the text variant of the message on LHN at runtime. Hope it clears your doubt. |
@roryabraham @pranshuchittora I don't think we need to implement a perfect conversion to markdown and can start with a simple line breaks to new lines conversion for now then add other features later. @roryabraham not sure if you feel the same way or not. @pranshuchittora no that's not correct as @parasharrajat has pointed out. One situation calls for: HTML -> markdown with line breaks converted to |
Seems like a great place to start, and keeps the scope of this issue nice and tidy. A couple questions:
|
I think they'd be plain text for now (so strip all tags but replace
Sounds like a great idea to me. |
@pranshuchittora just sent you the contract in Upwork, thanks! |
Created a tracking issue for other HTML ---> MD conversions here |
hey @pranshuchittora! how are you getting on with the PR? Is there anything you need help with? |
Hi @NicMendonca I am working on it but the version of |
Thought @roryabraham @marcaaron Peek.2021-05-27.01-12.mp4Current Implementation Future Architecture BlockersVersion of |
Until recently, we were pointing Expensify.cash at an expensify-common commit hash rather than actually publishing expensify-common on npm. It looks like @jasperhuangg changed that here. @marcaaron since you wrote the SO that @jasperhuangg references in that PR, do you have any comment on whether or not we should be publishing expensify-common on NPM vs just using a commit hash? |
The SO that Jasper linked to is a very general SO that was written with the context of web-e, web-s, and mobile. It wasn't really meant to cover e.cash. @AndrewGable talked about this a lot in the beginning and I think our takeaway was:
At the time, there were doubts if we could maintain the strict control we needed, which is why we used the hash. Here is the full context behind it: https://github.com/Expensify/Expensify/issues/147306 and it looks like the concern was never resolved. |
I think we should revert Jasper's change until the solution recommended in that linked issue is solved. |
Agreed @tgolen. So @pranshuchittora your process should probably be something like this:
|
That SO is out of date and should be deleted. I wrote those instructions thinking we would adopt that plan (we didn't) and then went OOO and it slipped my mind. Amending it now, but we should revert @jasperhuangg's changes. |
Sorry, I've updated those instructions so we can avoid this in the future. |
Hey! Sorry for missing this. I wasn't aware that there was a difference, apologies for failing to notice this. I guess something felt slightly off when it was startimg off at version 1.0.0, but I didn't think much of it. Glad you were able to revert the change! |
To summarise
Is this correct? |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Expected Result:
Spaces should be visible in edit comment box
Actual Result:
Spaces are not visible in edit comment box.
Action Performed:
Workaround:
N/a
Platform:
Where is this issue occurring?
Web ✔️
iOS
Android
Desktop App
Mobile Web
Version Number: 1.0.43-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Expensify/Expensify Issue URL: https://www.upwork.com/jobs/~01aab2d470107fe14c
View all open jobs on Upwork
From @roryabraham https://expensify.slack.com/archives/C01GTK53T8Q/p1620849222131700
The text was updated successfully, but these errors were encountered: