-
Notifications
You must be signed in to change notification settings - Fork 45
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
Live Markdown for web refactor #394
Open
Skalakid
wants to merge
48
commits into
main
Choose a base branch
from
@Skalakid/web-parser-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Skalakid
changed the title
@skalakid/web parser refactor
Live Markdown for web refactor
Jun 20, 2024
Skalakid
force-pushed
the
@Skalakid/web-parser-refactor
branch
from
June 25, 2024 07:42
0af6f58
to
f853061
Compare
Skalakid
force-pushed
the
@Skalakid/web-parser-refactor
branch
from
June 26, 2024 13:58
701962c
to
38693c4
Compare
…react-native-live-markdown into @Skalakid/web-parser-refactor
Skalakid
force-pushed
the
@Skalakid/web-parser-refactor
branch
5 times, most recently
from
July 5, 2024 07:11
148a5d0
to
695f251
Compare
Skalakid
force-pushed
the
@Skalakid/web-parser-refactor
branch
from
July 5, 2024 07:14
695f251
to
862e74a
Compare
Skalakid
force-pushed
the
@Skalakid/web-parser-refactor
branch
from
July 5, 2024 07:22
b8bf435
to
0580f45
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
This PR refactors the web implementation of the Live Markdown library. The main goals of it are:
During this refactor phase we:
changed web live markdown HTML structure so now:
<p>
- it makes structure much clear and organized, and enables us to apply custom logic to specific lines<span data-type="text">
tag - by wrapping text with HTML element we enable many useful functions that aren't available in normal text node, for example:scrollIntoView()
\n
characters inside the input's HTML structure we use<br>
tags - br tags give use much more flexibility and fix problem with cursor navigation when using arrow keys when moving between markdown components<br>
tag is wrapped with<span data-type="br">
tag - it fixes many problems connected to cursor positioningThanks to the new structure we enabled the usage of many styles that were generating a lot of bugs in the past, like
display: block
. Also were able to remove all workarounds connected to cursor positioning.added HTML tree node structure, that represents current HTML dom and stores many important information about every element inside the input. Thanks to this tree structure we can easily interact with the markdown elements and we were able to completely refactor and improve the performance of cursor positioning algorithms
replaced all text value representation functions like
process value
ornormalizeValue
with onetextContent
variable that always contains properly formatted text value without any additional newlines from contentEditablesplit long files of code into smaller ones, and sort functions into utils
prepared the code for new, more complex features like inline images
This refactor was made as a part of inline image feature. After discovering some structure and logic limitations when creating inline image POC we decided to improve Live Markdown for web.
This refactor will fix or unblock following issues:
Related Issues
GH_LINK
Manual Tests
Since it's a big change it would be great to test it in all cases connected to:
Linked PRs
Expensify/App#40181 (comment)