Skip to content

Commit 93786ba

Browse files
authored
fix: disable unsupported buttons (#4242)
* fix: disable ... button and recover selection after changing text font * fix: add image block will close keyboard on Android * fix: the padding of align items are not equal * fix: callout block issues
1 parent f5bfcdc commit 93786ba

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
287287
italicToolbarItem,
288288
underlineToolbarItem,
289289
colorToolbarItem,
290-
moreToolbarItem,
291290
],
292291
child: Column(
293292
children: [

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class EmojiPickerButton extends StatelessWidget {
1717
this.defaultIcon,
1818
this.offset,
1919
this.direction,
20+
this.title,
2021
});
2122

2223
final String emoji;
@@ -27,6 +28,7 @@ class EmojiPickerButton extends StatelessWidget {
2728
final Widget? defaultIcon;
2829
final Offset? offset;
2930
final PopoverDirection? direction;
31+
final String? title;
3032

3133
@override
3234
Widget build(BuildContext context) {
@@ -79,7 +81,12 @@ class EmojiPickerButton extends StatelessWidget {
7981
mainAxisAlignment: MainAxisAlignment.center,
8082
onPressed: () async {
8183
final result = await context.push<EmojiPickerResult>(
82-
MobileEmojiPickerScreen.routeName,
84+
Uri(
85+
path: MobileEmojiPickerScreen.routeName,
86+
queryParameters: {
87+
MobileEmojiPickerScreen.pageTitle: title,
88+
},
89+
).toString(),
8390
);
8491
if (result != null) {
8592
onSubmitted(

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ class _CalloutBlockComponentWidgetState
147147
}
148148

149149
// get the emoji of the note block from the node's attributes or default to '📌'
150-
String get emoji => node.attributes[CalloutBlockKeys.icon] ?? '📌';
150+
String get emoji {
151+
final icon = node.attributes[CalloutBlockKeys.icon];
152+
if (icon == null || icon.isEmpty) {
153+
return '📌';
154+
}
155+
return icon;
156+
}
151157

152158
// get access to the editor state via provider
153159
@override
@@ -184,6 +190,7 @@ class _CalloutBlockComponentWidgetState
184190
key: ValueKey(
185191
emoji.toString(),
186192
), // force to refresh the popover state
193+
title: '',
187194
emoji: emoji,
188195
onSubmitted: (emoji, controller) {
189196
setEmoji(emoji);

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_align_items.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AlignItems extends StatelessWidget {
4545
isSelected: currentIndex == index,
4646
icon: e.$2,
4747
),
48-
if (index != 0 || index != alignMenuItems.length - 1)
48+
if (index != 0 && index != alignMenuItems.length - 1)
4949
const HSpace(12),
5050
],
5151
)

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_color_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Future<void> showTextColorAndBackgroundColorPicker(
2525
backgroundColor: theme.toolbarMenuBackgroundColor,
2626
elevation: 20,
2727
title: LocaleKeys.grid_selectOption_colorPanelTitle.tr(),
28-
padding: const EdgeInsets.fromLTRB(18, 4, 18, 0),
28+
padding: const EdgeInsets.fromLTRB(18, 4, 18, 8),
2929
builder: (context) {
3030
return _TextColorAndBackgroundColor(
3131
editorState: editorState,

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_font_item.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class FontFamilyItem extends StatelessWidget {
2727
return MobileToolbarMenuItemWrapper(
2828
size: const Size(144, 52),
2929
onTap: () async {
30+
keepEditorFocusNotifier.increase();
3031
final selection = editorState.selection;
3132
final newFont = await context
3233
.read<GoRouter>()
@@ -36,13 +37,17 @@ class FontFamilyItem extends StatelessWidget {
3637
AppFlowyRichTextKeys.fontFamily:
3738
GoogleFonts.getFont(newFont).fontFamily,
3839
});
39-
await editorState.updateSelectionWithReason(
40+
}
41+
// wait for the font picker screen to be dismissed.
42+
Future.delayed(const Duration(milliseconds: 250), () {
43+
// highlight the selected text again.
44+
editorState.updateSelectionWithReason(
4045
selection,
4146
extraInfo: {
4247
selectionExtraInfoDisableFloatingToolbar: true,
4348
},
4449
);
45-
}
50+
});
4651
},
4752
text: fontFamily ?? systemFonFamily,
4853
fontFamily: fontFamily ?? systemFonFamily,

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_toolbar_item.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ class _AddBlockMenu extends StatelessWidget {
210210
Future.delayed(const Duration(milliseconds: 400), () async {
211211
final imagePlaceholderKey = GlobalKey<ImagePlaceholderState>();
212212
await editorState.insertEmptyImageBlock(imagePlaceholderKey);
213-
214-
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
215-
imagePlaceholderKey.currentState?.controller.show();
216-
});
217213
});
218214
},
219215
),

0 commit comments

Comments
 (0)