-
Notifications
You must be signed in to change notification settings - Fork 268
support RTL in toolbar #496
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
Conversation
MayurSMahajan
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.
Can you add a test for this, so we ensure new changes don't break your feature.
|
ok @MayurSMahajan, I will write test also for this. I have added the testcases for toolbar layout, please can you check once ? |
|
Nice try! |
3da4f10 to
4b2fecb
Compare
|
There was commit lint issue, that's why jobs were failing so, |
|
Looks good to me. |
| List<ToolbarItem> _computeActiveItems() { | ||
| List<ToolbarItem> activeItems = widget.items | ||
| .where((e) => e.isActive?.call(editorState) ?? false) | ||
| .toList(); | ||
| if (activeItems.isEmpty) { | ||
| return []; | ||
| } | ||
| if (widget.layoutDirection == TextDirection.rtl) { | ||
| activeItems = activeItems.reversed.toList(); | ||
| } | ||
| // sort by group. | ||
| activeItems.sort( | ||
| (a, b) => widget.layoutDirection == TextDirection.ltr | ||
| ? a.group.compareTo(b.group) | ||
| : b.group.compareTo(a.group), | ||
| ); | ||
| // insert the divider. | ||
| return activeItems | ||
| .splitBetween((first, second) => first.group != second.group) | ||
| .expand((element) => [...element, placeholderItem]) | ||
| .toList() | ||
| ..removeLast(); | ||
| } |
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.
Why do you move this code from floating_toolbar_widget to 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.
@LucasXu0
actually in tests, I was not able to verify the order of toolbarItems, that's why moved there so now I am able to verify it by taking it from parameters.
as IDs are assigned to ToolbarItem model, not to widgets.
yes. so please run |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #496 +/- ##
==========================================
+ Coverage 80.48% 80.58% +0.09%
==========================================
Files 281 280 -1
Lines 11800 11809 +9
==========================================
+ Hits 9497 9516 +19
+ Misses 2303 2293 -10
☔ View full report in Codecov by Sentry. |
|
@1akhanBaheti I optimized some parts of your code. please check this commit. the most important change is that I used the text direction of the row instead of reversing the toolbar items. |
* main: (39 commits) feat: support RTL in toolbar (AppFlowy-IO#496) fix: unable to update selection sometimes when the editor lost focus (AppFlowy-IO#509) fix: delete the divider on mobile will raise an error (AppFlowy-IO#508) fix: the cursor will flicker one frame to its previous position (AppFlowy-IO#506) fix: undo failed in a nested list in a special case (AppFlowy-IO#503) chore: bump version 1.4.3 (AppFlowy-IO#502) fix: image block rect overflow fix: the text within the <mark> tag didn't parse correctly when pasting HTML. chore: bump version 1.4.2 fix: command shortcuts on the web platform should also respect the operating system fix: focus will lost when typing slash fix: unable to input text on web platform fix: unable to change RTL of heading (AppFlowy-IO#495) fix: fix mobile selection drag (AppFlowy-IO#490) chore: bump version 1.4.1 fix: the placeholder doesn't appear on desktop platform fix: required named parameter 'onLiveTextInput' must be provided feat: add support for font family and font size attributes in rich text (AppFlowy-IO#486) fix: the color of text and highlight icon should be white (AppFlowy-IO#485) chore: bump version 1.4.0 (AppFlowy-IO#484) ...
Feature Preview
FR raised here also :
AppFlowy-IO/AppFlowy#3481