Browse Source

fix: 0.2.3 known issues (#2886)

* fix: option menu position

* fix: rename helps highlight the text for the user

* fix: export as markdown file name invalid

* chore: align the emoji in callout

* fix: leave more space in the editor

* fix: 0.2.3 known issues

* chore: add flutter pub get in flutter.toml
Lucas.Xu 1 year ago
parent
commit
d665153a9f

+ 17 - 4
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart

@@ -5,6 +5,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/database/r
 import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
 import 'package:appflowy/plugins/document/presentation/editor_style.dart';
 import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:flowy_infra_ui/flowy_infra_ui.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_bloc/flutter_bloc.dart';
 
@@ -132,6 +133,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
       characterShortcutEvents: characterShortcutEvents,
       commandShortcutEvents: commandShortcutEvents,
       header: widget.header,
+      footer: const VSpace(200),
     );
 
     return Center(
@@ -161,7 +163,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
     ];
 
     final configuration = BlockComponentConfiguration(
-      padding: (_) => const EdgeInsets.symmetric(vertical: 4.0),
+      padding: (_) => const EdgeInsets.symmetric(vertical: 5.0),
     );
     final customBlockComponentBuilderMap = {
       PageBlockKeys.type: PageBlockComponentBuilder(),
@@ -211,7 +213,10 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
       CalloutBlockKeys.type: CalloutBlockComponentBuilder(
         configuration: configuration,
       ),
-      DividerBlockKeys.type: DividerBlockComponentBuilder(),
+      DividerBlockKeys.type: DividerBlockComponentBuilder(
+        configuration: configuration,
+        height: 28.0,
+      ),
       MathEquationBlockKeys.type: MathEquationBlockComponentBuilder(
         configuration: configuration.copyWith(
           padding: (_) => const EdgeInsets.symmetric(vertical: 20),
@@ -277,7 +282,13 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
       ];
 
       builder.showActions = (_) => true;
-      builder.actionBuilder = (context, state) => BlockActionList(
+      builder.actionBuilder = (context, state) {
+        final padding = context.node.type == HeadingBlockKeys.type
+            ? const EdgeInsets.only(top: 8.0)
+            : const EdgeInsets.all(0);
+        return Padding(
+          padding: padding,
+          child: BlockActionList(
             blockComponentContext: context,
             blockComponentState: state,
             editorState: widget.editorState,
@@ -285,7 +296,9 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
             showSlashMenu: () => showSlashMenu(
               widget.editorState,
             ),
-          );
+          ),
+        );
+      };
     }
 
     return builders;

+ 2 - 2
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_list.dart

@@ -31,14 +31,14 @@ class BlockActionList extends StatelessWidget {
           editorState: editorState,
           showSlashMenu: showSlashMenu,
         ),
-        const SizedBox(width: 8.0),
+        const SizedBox(width: 4.0),
         BlockOptionButton(
           blockComponentContext: blockComponentContext,
           blockComponentState: blockComponentState,
           actions: actions,
           editorState: editorState,
         ),
-        const SizedBox(width: 6.0),
+        const SizedBox(width: 4.0),
       ],
     );
   }

+ 5 - 1
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart

@@ -150,7 +150,11 @@ class _CalloutBlockComponentWidgetState
         children: [
           // the emoji picker button for the note
           Padding(
-            padding: const EdgeInsets.all(2.0),
+            padding: const EdgeInsets.only(
+              top: 6.0,
+              left: 2.0,
+              right: 2.0,
+            ),
             child: EmojiPickerButton(
               key: ValueKey(
                 emoji.toString(),

+ 2 - 1
frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart

@@ -118,7 +118,8 @@ class ShareActionListState extends State<ShareActionList> {
           case ShareAction.markdown:
             final exportPath = await getIt<FilePickerService>().saveFile(
               dialogTitle: '',
-              fileName: '$name.md',
+              // encode the file name in case it contains special characters
+              fileName: '${Uri.encodeComponent(name)}.md',
             );
             if (exportPath != null) {
               docShareBloc.add(DocShareEvent.shareMarkdown(exportPath));

+ 1 - 0
frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/header.dart

@@ -87,6 +87,7 @@ class MenuAppHeader extends StatelessWidget {
               case AppDisclosureAction.rename:
                 NavigatorTextFieldDialog(
                   title: LocaleKeys.menuAppHeader_renameDialog.tr(),
+                  autoSelectAllText: true,
                   value: context.read<AppBloc>().state.view.name,
                   confirm: (newValue) {
                     context.read<AppBloc>().add(AppEvent.rename(newValue));

+ 1 - 0
frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/section/item.dart

@@ -99,6 +99,7 @@ class ViewSectionItem extends StatelessWidget {
               case ViewDisclosureAction.rename:
                 NavigatorTextFieldDialog(
                   title: LocaleKeys.disclosureAction_rename.tr(),
+                  autoSelectAllText: true,
                   value: blocContext.read<ViewBloc>().state.view.name,
                   confirm: (newValue) {
                     blocContext

+ 21 - 10
frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart

@@ -12,29 +12,40 @@ export 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
 import 'package:appflowy/generated/locale_keys.g.dart';
 
 class NavigatorTextFieldDialog extends StatefulWidget {
-  final String value;
-  final String title;
-  final void Function()? cancel;
-  final void Function(String) confirm;
-
   const NavigatorTextFieldDialog({
+    super.key,
     required this.title,
+    this.autoSelectAllText = false,
     required this.value,
     required this.confirm,
     this.cancel,
-    Key? key,
-  }) : super(key: key);
+  });
+
+  final String value;
+  final String title;
+  final void Function()? cancel;
+  final void Function(String) confirm;
+  final bool autoSelectAllText;
 
   @override
-  State<NavigatorTextFieldDialog> createState() => _CreateTextFieldDialog();
+  State<NavigatorTextFieldDialog> createState() =>
+      _NavigatorTextFieldDialogState();
 }
 
-class _CreateTextFieldDialog extends State<NavigatorTextFieldDialog> {
+class _NavigatorTextFieldDialogState extends State<NavigatorTextFieldDialog> {
   String newValue = "";
+  final controller = TextEditingController();
 
   @override
   void initState() {
     newValue = widget.value;
+    controller.text = newValue;
+    if (widget.autoSelectAllText) {
+      controller.selection = TextSelection(
+        baseOffset: 0,
+        extentOffset: newValue.length,
+      );
+    }
     super.initState();
   }
 
@@ -52,7 +63,7 @@ class _CreateTextFieldDialog extends State<NavigatorTextFieldDialog> {
           FlowyFormTextInput(
             textAlign: TextAlign.center,
             hintText: LocaleKeys.dialogCreatePageNameHint.tr(),
-            initialValue: widget.value,
+            controller: controller,
             textStyle: Theme.of(context).textTheme.bodySmall?.copyWith(
                   fontSize: FontSizes.s16,
                 ),

+ 2 - 2
frontend/appflowy_flutter/pubspec.lock

@@ -53,8 +53,8 @@ packages:
     dependency: "direct main"
     description:
       path: "."
-      ref: "4f83b6f"
-      resolved-ref: "4f83b6feb92963f104f3f1f77a473a06aa4870f5"
+      ref: cd0f67a
+      resolved-ref: cd0f67a48e40188114800fae9a0f59cafe15b0f2
       url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
     source: git
     version: "1.0.4"

+ 1 - 1
frontend/appflowy_flutter/pubspec.yaml

@@ -46,7 +46,7 @@ dependencies:
   appflowy_editor:
     git:
       url: https://github.com/AppFlowy-IO/appflowy-editor.git
-      ref: 4f83b6f
+      ref: cd0f67a
   appflowy_popover:
     path: packages/appflowy_popover
 

+ 2 - 0
frontend/scripts/makefile/flutter.toml

@@ -188,6 +188,7 @@ script = [
   """
   cd appflowy_flutter
   flutter clean
+  flutter pub get
   flutter packages pub get
   dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
   dart run build_runner build -d
@@ -200,6 +201,7 @@ script = [
   """
   cd ./appflowy_flutter/
   exec cmd.exe /c flutter clean
+  exec cmd.exe /c flutter pub get
   exec cmd.exe /c flutter packages pub get
   exec cmd.exe /c dart run easy_localization:generate -S assets/translations/ -f keys -o locale_keys.g.dart -S assets/translations -s en.json
   exec cmd.exe /c dart run build_runner build -d