-
Notifications
You must be signed in to change notification settings - Fork 550
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
Added text direction feature #438
Conversation
e75604f
to
f1a6fa0
Compare
I just removed LTR attribute since missing RTL attribute will be interpreted as LTR. I also removed using editor's parents directionality as default direction for text lines since it would cause getting different results using the same Notus document with different locales. @pulyaevskiy |
766df57
to
21b1c3a
Compare
21b1c3a
to
6685ecc
Compare
Rebased @pulyaevskiy . |
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.
To be honest I really know nothing about LTR/RTL so I'm mostly asking questions about the topic in hopes to better understand it. PTAL at the comments.
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.
Have a few more nits, but otherwise looks good. PTAL!
Thanks again for taking time to educate me on RTL.
children.add(Directionality( | ||
textDirection: nodeTextDirection, |
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.
Just me learning RTL again. I suspect we still need to wrap with Directionality so that everything else inside the EditableTextLine can pick it up correctly instead of relying on the default value inherited from the app?
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.
Isn't that happening here? The EditableTextLine
is wrapped with Directionality widget. I think I didn't understand what you said correctly. Can you explain more?
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.
It was more of a question to confirm my understanding here. It just seems redundant to pass direction to the line widget but also wrap it with Directionality.
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.
Hmmm now that I checked it again I can't remember why I did that. I think there was a reason for that back then but it makes no sense now. So I removed all of them and using provider pattern instead. PTAL.
@@ -49,30 +49,43 @@ class EditableTextBlock extends StatelessWidget { | |||
); | |||
} | |||
|
|||
TextDirection getTextDirectionForNode(BuildContext context, StyledNode node) { |
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.
BuildContext doesn't seem to be used here.
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.
It was being used before for getting default directionality but it isn't needed anymore.
return TextDirection.rtl; | ||
} | ||
return TextDirection.ltr; | ||
} |
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.
This method seems to be duplicated in a couple of places. Would be nice to have it in one place only.
1f8f25d
to
da206bd
Compare
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, thanks!
I've added text direction support to the both Notus and Zefyr. It matches the behavior of Quill's rich text editor based on my tests.