Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: update editor version (#5918)
Lucas.Xue2a923a79693
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_markdown_text.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_markdown_text.dartindex ff7cb6bafe..e5359161b4 100644--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_markdown_text.dart+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_markdown_text.dart@@ -124,6 +124,7 @@ class _AppFlowyEditorMarkdownState extends State<_AppFlowyEditorMarkdown> {editorScrollController: scrollController,blockComponentBuilders: blockBuilders,commandShortcutEvents: [customCopyCommand],+ disableAutoScroll: true,editorState: editorState,),);diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/layout/sizes.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/layout/sizes.dartindex c028df7ced..2b1e558569 100755--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/layout/sizes.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/layout/sizes.dart@@ -15,6 +15,7 @@ class GridSize {static double get popoverItemHeight => 26 * scale;static double get typeOptionSeparatorHeight => 4 * scale;static double get newPropertyButtonWidth => 140 * scale;+ static double get mobileNewPropertyButtonWidth => 200 * scale;static EdgeInsets get cellContentInsets => EdgeInsets.symmetric(horizontal: GridSize.cellHPadding,diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dartindex 90bfbbca13..8c7f931b40 100644--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart@@ -197,7 +197,7 @@ class _CreateFieldButtonState extends State<CreateFieldButton> {Widget build(BuildContext context) {return Container(constraints: BoxConstraints(- maxWidth: GridSize.newPropertyButtonWidth,+ maxWidth: GridSize.mobileNewPropertyButtonWidth,minHeight: GridSize.headerHeight,),decoration: _getDecoration(context),diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dartindex 8d8312073a..c4fa7e134c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart@@ -189,7 +189,10 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({),),CalloutBlockKeys.type: CalloutBlockComponentBuilder(- configuration: configuration.copyWith(),+ configuration: configuration.copyWith(+ padding: (node) => const EdgeInsets.symmetric(vertical: 10),+ ),+ inlinePadding: const EdgeInsets.symmetric(vertical: 8.0),defaultColor: calloutBGColor,),DividerBlockKeys.type: DividerBlockComponentBuilder(diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dartindex 2fbd0a3986..87eec5b47c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart@@ -154,6 +154,9 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {// callout blockinsertNewLineInCalloutBlock,+ // quote block+ insertNewLineInQuoteBlock,+// toggle listformatGreaterToToggleList,insertChildNodeInsideToggleList,diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dartindex a487634a93..69e026f43f 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart@@ -20,6 +20,7 @@ class EmojiPickerButton extends StatelessWidget {this.title,this.showBorder = true,this.enable = true,+ this.margin,});final String emoji;@@ -33,6 +34,7 @@ class EmojiPickerButton extends StatelessWidget {final String? title;final bool showBorder;final bool enable;+ final EdgeInsets? margin;@overrideWidget build(BuildContext context) {@@ -44,6 +46,7 @@ class EmojiPickerButton extends StatelessWidget {height: emojiPickerSize.height,),offset: offset,+ margin: EdgeInsets.zero,direction: direction ?? PopoverDirection.rightWithTopAligned,popupBuilder: (_) => Container(width: emojiPickerSize.width,@@ -79,15 +82,16 @@ class EmojiPickerButton extends StatelessWidget {);}- return FlowyTextButton(- emoji,- overflow: TextOverflow.visible,- fontSize: emojiSize,- padding: EdgeInsets.zero,- constraints: const BoxConstraints.tightFor(width: 36.0),- fillColor: Colors.transparent,- mainAxisAlignment: MainAxisAlignment.center,- onPressed: enable+ return FlowyButton(+ useIntrinsicWidth: true,+ margin:+ margin ?? const EdgeInsets.symmetric(horizontal: 8.0, vertical: 6.0),+ text: FlowyText.emoji(+ emoji,+ fontSize: emojiSize,+ optimizeEmojiAlign: true,+ ),+ onTap: enable? () async {final result = await context.push<EmojiPickerResult>(Uri(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.dartindex 3b1dc69920..d17f48e246 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@@ -68,9 +68,11 @@ class CalloutBlockComponentBuilder extends BlockComponentBuilder {CalloutBlockComponentBuilder({super.configuration,required this.defaultColor,+ required this.inlinePadding,});final Color defaultColor;+ final EdgeInsets inlinePadding;@overrideBlockComponentWidget build(BlockComponentContext blockComponentContext) {@@ -79,6 +81,7 @@ class CalloutBlockComponentBuilder extends BlockComponentBuilder {key: node.key,node: node,defaultColor: defaultColor,+ inlinePadding: inlinePadding,configuration: configuration,showActions: showActions(node),actionBuilder: (context, state) => actionBuilder(@@ -105,9 +108,11 @@ class CalloutBlockComponentWidget extends BlockComponentStatefulWidget {super.actionBuilder,super.configuration = const BlockComponentConfiguration(),required this.defaultColor,+ required this.inlinePadding,});final Color defaultColor;+ final EdgeInsets inlinePadding;@overrideState<CalloutBlockComponentWidget> createState() =>@@ -176,6 +181,7 @@ class _CalloutBlockComponentWidgetStateborderRadius: const BorderRadius.all(Radius.circular(8.0)),color: backgroundColor,),+ padding: widget.inlinePadding,width: double.infinity,alignment: alignment,child: Row(@@ -183,27 +189,22 @@ class _CalloutBlockComponentWidgetStatemainAxisSize: MainAxisSize.min,textDirection: textDirection,children: [+ if (PlatformExtension.isDesktopOrWeb) const HSpace(4.0),// the emoji picker button for the note- Padding(- padding: const EdgeInsets.only(- top: 6.0,- left: 4.0,- right: 4.0,- ),- child: EmojiPickerButton(- key: ValueKey(- emoji.toString(),- ), // force to refresh the popover state- enable: editorState.editable,- title: '',- emoji: emoji,- emojiSize: 16.0,- onSubmitted: (emoji, controller) {- setEmoji(emoji);- controller?.close();- },- ),+ EmojiPickerButton(+ key: ValueKey(+ emoji.toString(),+ ), // force to refresh the popover state+ enable: editorState.editable,+ title: '',+ emoji: emoji,+ emojiSize: 15.0,+ onSubmitted: (emoji, controller) {+ setEmoji(emoji);+ controller?.close();+ },),+ if (PlatformExtension.isDesktopOrWeb) const HSpace(4.0),Flexible(child: Padding(padding: const EdgeInsets.symmetric(vertical: 4.0),@@ -248,24 +249,21 @@ class _CalloutBlockComponentWidgetStateBuildContext context,TextDirection textDirection,) {- return Padding(- padding: padding,- child: AppFlowyRichText(- key: forwardKey,- delegate: this,- node: widget.node,- editorState: editorState,- placeholderText: placeholderText,- textSpanDecorator: (textSpan) => textSpan.updateTextStyle(- textStyle,- ),- placeholderTextSpanDecorator: (textSpan) => textSpan.updateTextStyle(- placeholderTextStyle,- ),- textDirection: textDirection,- cursorColor: editorState.editorStyle.cursorColor,- selectionColor: editorState.editorStyle.selectionColor,+ return AppFlowyRichText(+ key: forwardKey,+ delegate: this,+ node: widget.node,+ editorState: editorState,+ placeholderText: placeholderText,+ textSpanDecorator: (textSpan) => textSpan.updateTextStyle(+ textStyle,+ ),+ placeholderTextSpanDecorator: (textSpan) => textSpan.updateTextStyle(+ placeholderTextStyle,),+ textDirection: textDirection,+ cursorColor: editorState.editorStyle.cursorColor,+ selectionColor: editorState.editorStyle.selectionColor,);}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_cut_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_cut_command.dartindex e7f6fba181..db83e8e5f6 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_cut_command.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_cut_command.dart@@ -1,6 +1,6 @@import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart';import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';-import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:appflowy_editor/appflowy_editor.dart' hide EditorCopyPaste;import 'package:flutter/material.dart';/// cut.diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_paste_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_paste_command.dartindex e81cf2f325..85b290863e 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_paste_command.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_paste_command.dart@@ -7,7 +7,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_pimport 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_plain_text.dart';import 'package:appflowy/startup/startup.dart';import 'package:appflowy_backend/log.dart';-import 'package:appflowy_editor/appflowy_editor.dart' hide Log;+import 'package:appflowy_editor/appflowy_editor.dart' hide Log, EditorCopyPaste;import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_html.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_html.dartindex e30bcf8a5d..2047e6dd47 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_html.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_html.dart@@ -1,5 +1,5 @@import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart';-import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:appflowy_editor/appflowy_editor.dart' hide EditorCopyPaste;extension PasteFromHtml on EditorState {Future<bool> pasteHtml(String html) async {diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_in_app_json.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_in_app_json.dartindex 4cc17d599b..8e425aeab6 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_in_app_json.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_in_app_json.dart@@ -2,7 +2,7 @@ import 'dart:convert';import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart';import 'package:appflowy_backend/log.dart';-import 'package:appflowy_editor/appflowy_editor.dart' hide Log;+import 'package:appflowy_editor/appflowy_editor.dart' hide Log, EditorCopyPaste;extension PasteFromInAppJson on EditorState {Future<bool> pasteInAppJson(String inAppJson) async {diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_plain_text.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_plain_text.dartindex 114dde62a3..6100a0056d 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_plain_text.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/paste_from_plain_text.dart@@ -1,6 +1,6 @@import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart';import 'package:appflowy/shared/patterns/common_patterns.dart';-import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:appflowy_editor/appflowy_editor.dart' hide EditorCopyPaste;extension PasteFromPlainText on EditorState {Future<void> pastePlainText(String plainText) async {diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/plugins.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/plugins.dartindex acbd3a1627..abc05d242c 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/plugins.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/plugins.dart@@ -51,6 +51,7 @@ export 'openai/widgets/smart_edit_node_widget.dart';export 'openai/widgets/smart_edit_toolbar_item.dart';export 'outline/outline_block_component.dart';export 'parsers/markdown_parsers.dart';+export 'quote/quote_block_shortcuts.dart';export 'slash_menu/slash_menu_items.dart';export 'table/table_menu.dart';export 'table/table_option_action.dart';diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_shortcuts.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_shortcuts.dartnew file mode 100644index 0000000000..ba3ad6e7df--- /dev/null+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_shortcuts.dart@@ -0,0 +1,39 @@+import 'package:appflowy_editor/appflowy_editor.dart';+import 'package:flutter/services.dart';++/// Pressing Enter in a quote block will insert a newline (\n) within the quote,+/// while pressing Shift+Enter in a quote will insert a new paragraph next to the quote.+///+/// - support+/// - desktop+/// - mobile+/// - web+///+final CharacterShortcutEvent insertNewLineInQuoteBlock = CharacterShortcutEvent(+ key: 'insert a new line in quote block',+ character: '\n',+ handler: _insertNewLineHandler,+);++CharacterShortcutEventHandler _insertNewLineHandler = (editorState) async {+ final selection = editorState.selection?.normalized;+ if (selection == null) {+ return false;+ }++ final node = editorState.getNodeAtPath(selection.start.path);+ if (node == null || node.type != QuoteBlockKeys.type) {+ return false;+ }++ // delete the selection+ await editorState.deleteSelection(selection);++ if (HardwareKeyboard.instance.isShiftPressed) {+ await editorState.insertNewLine();+ } else {+ await editorState.insertTextAtCurrentSelection('\n');+ }++ return true;+};diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dartindex 99bb96c2fe..3073833e17 100644--- a/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart+++ b/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart@@ -1,5 +1,3 @@-import 'package:flutter/material.dart';-import 'package:appflowy/generated/locale_keys.g.dart';import 'package:appflowy/plugins/database/application/tab_bar_bloc.dart';import 'package:appflowy/plugins/shared/share/share_bloc.dart';@@ -7,7 +5,7 @@ import 'package:appflowy/plugins/shared/share/share_menu.dart';import 'package:appflowy_popover/appflowy_popover.dart';import 'package:easy_localization/easy_localization.dart';import 'package:flowy_infra_ui/flowy_infra_ui.dart';-import 'package:flowy_infra_ui/widget/rounded_button.dart';+import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';class ShareMenuButton extends StatelessWidget {@@ -55,18 +53,17 @@ class _ShareButton extends StatelessWidget {@overrideWidget build(BuildContext context) {- return RoundedTextButton(- title: LocaleKeys.shareAction_buttonText.tr(),- padding: const EdgeInsets.symmetric(horizontal: 14.0),- fontSize: 14.0,- fontWeight: FontWeight.w500,- borderRadius: const BorderRadius.all(- Radius.circular(10.0),+ return FlowyButton(+ text: FlowyText(+ LocaleKeys.shareAction_buttonText.tr(),+ fontSize: 14.0,+ fontWeight: FontWeight.w500,+ color: Theme.of(context).colorScheme.onPrimary,),- textColor: Theme.of(context).colorScheme.onPrimary,- onPressed: () {- // Do nothing, but it needs to provide an empty action in order to show cursorß- },+ margin: const EdgeInsets.symmetric(horizontal: 14.0),+ backgroundColor: Theme.of(context).colorScheme.primary,+ hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9),+ radius: BorderRadius.circular(10.0),);}}diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dartindex e5a9ce404f..fba47aa7d7 100644--- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart+++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart@@ -159,6 +159,7 @@ class FlowyButton extends StatelessWidget {final double iconPadding;final bool expand;final Color? borderColor;+ final Color? backgroundColor;const FlowyButton({super.key,@@ -183,6 +184,7 @@ class FlowyButton extends StatelessWidget {this.iconPadding = 6,this.expand = false,this.borderColor,+ this.backgroundColor,});@override@@ -211,6 +213,7 @@ class FlowyButton extends StatelessWidget {borderRadius: radius ?? Corners.s6Border,hoverColor: color,borderColor: borderColor ?? Colors.transparent,+ backgroundColor: backgroundColor ?? Colors.transparent,),onHover: disable ? null : onHover,isSelected: () => isSelected,diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lockindex 6bedfe8cc4..7046e40f67 100644--- a/frontend/appflowy_flutter/pubspec.lock+++ b/frontend/appflowy_flutter/pubspec.lock@@ -53,8 +53,8 @@ packages:dependency: "direct main"description:path: "."- ref: "0317779"- resolved-ref: "031777941ce53fe1aaa9a23177f6045b142e6e73"+ ref: "3d6aff0"+ resolved-ref: "3d6aff0d21de96411675417ab952f315cc949c7a"url: "https://github.com/AppFlowy-IO/appflowy-editor.git"source: gitversion: "3.1.0"@@ -1198,10 +1198,10 @@ packages:dependency: "direct main"description:name: keyboard_height_plugin- sha256: bbb32804bf93601249c17c33125cd2e654f5ef650fc6acf1b031d69b478b35ce+ sha256: "3a51c8ebb43465ebe0b3bad17f3b6d945421e58011f3f5a08134afe69a3d775f"url: "https://pub.dev"source: hosted- version: "0.0.5"+ version: "0.1.5"leak_tracker:dependency: "direct main"description:diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yamlindex 3a6064c9d6..dcb6004982 100644--- a/frontend/appflowy_flutter/pubspec.yaml+++ b/frontend/appflowy_flutter/pubspec.yaml@@ -124,7 +124,7 @@ dependencies:image_gallery_saver: ^2.0.3cached_network_image: ^3.3.0leak_tracker: ^10.0.0- keyboard_height_plugin: ^0.0.5+ keyboard_height_plugin: ^0.1.5scrollable_positioned_list: ^0.3.8flutter_cache_manager: ^3.3.1share_plus: ^7.2.1@@ -199,7 +199,7 @@ dependency_overrides:appflowy_editor:git:url: https://github.com/AppFlowy-IO/appflowy-editor.git- ref: "0317779"+ ref: "3d6aff0"appflowy_editor_plugins:git: