diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart index 30d8af6664..f92918b464 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart +++ b/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 { characterShortcutEvents: characterShortcutEvents, commandShortcutEvents: commandShortcutEvents, header: widget.header, + footer: const VSpace(200), ); return Center( @@ -161,7 +163,7 @@ class _AppFlowyEditorPageState extends State { ]; 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 { 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 { ]; 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 { showSlashMenu: () => showSlashMenu( widget.editorState, ), - ); + ), + ); + }; } return builders; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_list.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_list.dart index 40ae6feb00..da7b3a0d38 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_list.dart +++ b/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), ], ); } diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart index 8eb97c6d41..2e6b63fe5b 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart +++ b/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(), diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart index 162315a5e0..90c3694db5 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart @@ -118,7 +118,8 @@ class ShareActionListState extends State { case ShareAction.markdown: final exportPath = await getIt().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)); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/header.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/header.dart index 82ffd93d40..c33993e242 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/header/header.dart +++ b/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().state.view.name, confirm: (newValue) { context.read().add(AppEvent.rename(newValue)); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/section/item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/section/item.dart index acd8adf682..6043d7a694 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/app/section/item.dart +++ b/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().state.view.name, confirm: (newValue) { blocContext diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart index 5b62a726bc..96d66e2188 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart +++ b/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 { + const NavigatorTextFieldDialog({ + super.key, + required this.title, + this.autoSelectAllText = false, + required this.value, + required this.confirm, + this.cancel, + }); + final String value; final String title; final void Function()? cancel; final void Function(String) confirm; - - const NavigatorTextFieldDialog({ - required this.title, - required this.value, - required this.confirm, - this.cancel, - Key? key, - }) : super(key: key); + final bool autoSelectAllText; @override - State createState() => _CreateTextFieldDialog(); + State createState() => + _NavigatorTextFieldDialogState(); } -class _CreateTextFieldDialog extends State { +class _NavigatorTextFieldDialogState extends State { 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 { FlowyFormTextInput( textAlign: TextAlign.center, hintText: LocaleKeys.dialogCreatePageNameHint.tr(), - initialValue: widget.value, + controller: controller, textStyle: Theme.of(context).textTheme.bodySmall?.copyWith( fontSize: FontSizes.s16, ), diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock index 6e4e83c07f..ea8db53286 100644 --- a/frontend/appflowy_flutter/pubspec.lock +++ b/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" diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml index ae73a6e4f2..5d762d68dc 100644 --- a/frontend/appflowy_flutter/pubspec.yaml +++ b/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 diff --git a/frontend/scripts/makefile/flutter.toml b/frontend/scripts/makefile/flutter.toml index ca501ca7a3..a94859fa39 100644 --- a/frontend/scripts/makefile/flutter.toml +++ b/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