-
Notifications
You must be signed in to change notification settings - Fork 97
Implement code and pre blocks support on web #456
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
Implement code and pre blocks support on web #456
Conversation
| } | ||
|
|
||
| if (node.nodeType === Node.TEXT_NODE) { | ||
| let hasAddedNewline = false; |
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.
the newline logic is confusing when adding codeblock after a codeblock or splitting one.
The input appears as in the new line, but it parses into the new codeblock only after manually pressing enter at the line break.
Screen.Recording.2025-06-16.at.18.08.56.mov
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.
One of the main goals of the Live Markdown Input is to preview how the message from Expensify will look after sending. In all scenarios, the code block syntax moves the content around it into separate lines (display: block). I agree that it can be a bit confusing, but we do the same thing for inline 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.
Maybe to make it more intuitive, we should require a whitespace after the codeblock closing syntax to be able to add another markdown after it. What do you think about it?
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.
Feels different with demo image bc the image is adding w/o additional character between blocks. I think this is the expected behaviour here as well.
Screen.Recording.2025-06-18.at.10.57.05.mov
| const currentLine = target.tree.childNodes[orderIndex]?.element; | ||
| const scrollTargetElement = currentLine || node.element; | ||
|
|
||
| if (!isChildOfMultilineMarkdownElement(node.element)) { |
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.
Found this multiline problem while testing, but it works same on main. IMO can be fixed as a followup.
Screen.Recording.2025-06-16.at.18.17.11.mov
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.
Okay, will fix that in follow up PR :D
|
Hello, here is the PR with required changes in the expensify-common library Expensify/expensify-common#865. Once it's merged we can proceed with with merging this PR |
…-parser-refactor-code-blocks
jmusial
left a comment
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 @tomekzaw do you want to take a look or it's ok if I merge it ? (on Monday 😄 )
|
Feel free to merge if the PR is okay 😄 |
| .react-native-live-markdown-input-singleline:empty::before, | ||
| .react-native-live-markdown-input-multiline:empty::before { | ||
| pointer-events: none; | ||
| display: block; /* For Firefox */ | ||
| content: attr(placeholder); |
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.
@BartoszGrajdek Why do we removed this part? It seems to cause an issue of not showing the placeholder
https://expensify.slack.com/archives/C049HHMV9SM/p1755884247194659
Yeah this composer style isn't looking right to me. I'm not against including the monospace font style & background + border styles in the composer, but if we're going to do that, we need the styles to match the end result (the sent message styles). Currently the colors look different and wrong to me. cc @dubielzyk-expensify |
|
I believe @Skalakid will update the styles of that in the App PR, so please let us know how you think it should look like Expensify/App#69158 |

Details
Related Issues
GH_LINK
Manual Tests
Change codeFance rule in
/node_modules/expensify-common/dist/ExpensiMark.jsto code belowLinked PRs