From c2fdfb6e89e3be9a146c9f77865b271d87da9b67 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Wed, 24 Jan 2024 22:45:13 +0800 Subject: [PATCH] fix: font shown in AA has _r as a suffix (#4482) --- .../mobile_toolbar_v3/_font_item.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_font_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_font_item.dart index 939d51d6ca..20ab08eca5 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_font_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_font_item.dart @@ -2,6 +2,7 @@ import 'package:appflowy/mobile/presentation/setting/font/font_picker_screen.dar import 'package:appflowy/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_toolbar_theme.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart'; import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart'; +import 'package:appflowy/util/google_font_family_extension.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -27,8 +28,16 @@ class FontFamilyItem extends StatelessWidget { return MobileToolbarMenuItemWrapper( size: const Size(144, 52), onTap: () async { - keepEditorFocusNotifier.increase(); final selection = editorState.selection; + // disable the floating toolbar + editorState.updateSelectionWithReason( + selection, + extraInfo: { + selectionExtraInfoDisableFloatingToolbar: true, + selectionExtraInfoDisableMobileToolbarKey: true, + }, + ); + final newFont = await context .read() .push(FontPickerScreen.routeName); @@ -45,11 +54,12 @@ class FontFamilyItem extends StatelessWidget { selection, extraInfo: { selectionExtraInfoDisableFloatingToolbar: true, + selectionExtraInfoDisableMobileToolbarKey: false, }, ); }); }, - text: fontFamily ?? systemFonFamily, + text: (fontFamily ?? systemFonFamily).parseFontFamilyName(), fontFamily: fontFamily ?? systemFonFamily, backgroundColor: theme.toolbarMenuItemBackgroundColor, isSelected: false,