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.
This is PR is moved to #2963
This is a work in progress
This plugin automatically adds
dir="ltr"
ordir="rtl"
to specified nodes based on their content. I stole the direction detection logic from lexicalI'm still new to ProseMirror and this plugin definitely needs to be polished. I appreciate your suggestions and help.
Demo
2022-06-16.11-30-04.mp4
HTML (from devtools):
TODO
setTextDirection
andunsetTextDirection
commands to manually specify the node's direction. These should have more precedence over the automatically detected direction so we can force a node to have a specific direction.dir
would be an actual attribute and will be in the HTML output. I still haven't figured out how to update a tiptap node's attributes within a ProseMirror plugin.Why not
dir="auto"
?more control
Why not a custom paragraph node?
headings and other text nodes also need it
Related issues
#116
#1621