Skip to content

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.

feat: support nested list in callout block and quote block (#7479)

Lucase69a09d332ba
diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart
index 574ae34af8..38bf2bcd14 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart
@@ -13,7 +13,6 @@ import 'package:appflowy_editor/appflowy_editor.dart'
NodeIterator,
NodeExternalValues,
HeadingBlockKeys,
- QuoteBlockKeys,
NumberedListBlockKeys,
BulletedListBlockKeys,
blockComponentDelta;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart
index 7e3b5347da..653bebf902 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart
@@ -6,7 +6,8 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/mo
import 'package:appflowy/plugins/document/presentation/editor_plugins/code_block/code_block_copy_button.dart';
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:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockComponentBuilder, quoteNode, QuoteBlockKeys;
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
import 'package:flowy_infra/theme_extension.dart';
@@ -121,10 +122,18 @@ BlockComponentConfiguration _buildDefaultConfiguration(BuildContext context) {
},
indentPadding: (node, textDirection) {
double padding = 26.0;
+
// only add indent padding for the top level node to align the children
if (UniversalPlatform.isMobile && node.path.length == 1) {
padding += EditorStyleCustomizer.nodeHorizontalPadding;
}
+
+ // in the quote block, we reduce the indent padding for the first level block.
+ // So we have to add more padding for the second level to avoid the drag menu overlay the quote icon.
+ if (node.isInQuote && node.level == 2) {
+ padding += 24;
+ }
+
return textDirection == TextDirection.ltr
? EdgeInsets.only(left: padding)
: EdgeInsets.only(right: padding);
@@ -203,6 +212,16 @@ void _customBlockOptionActions(
),
);
+ builder.actionTrailingBuilder = (context, state) {
+ if (context.node.parent?.type == QuoteBlockKeys.type) {
+ return const SizedBox(
+ width: 24,
+ height: 24,
+ );
+ }
+ return const SizedBox.shrink();
+ };
+
builder.actionBuilder = (context, state) {
double top = builder.configuration.padding(context.node).top;
final type = context.node.type;
@@ -592,6 +611,7 @@ QuoteBlockComponentBuilder _buildQuoteBlockComponentBuilder(
node: node,
configuration: configuration,
),
+ indentPadding: (node, _) => EdgeInsets.zero,
),
);
}
@@ -798,8 +818,14 @@ CalloutBlockComponentBuilder _buildCalloutBlockComponentBuilder(
configuration: configuration,
textSpan: textSpan,
),
+ indentPadding: (node, _) => EdgeInsets.only(left: 42),
),
- inlinePadding: const EdgeInsets.symmetric(vertical: 8.0),
+ inlinePadding: (node) {
+ if (node.children.isEmpty) {
+ return const EdgeInsets.symmetric(vertical: 8.0);
+ }
+ return EdgeInsets.only(top: 8.0, bottom: 2.0);
+ },
defaultColor: calloutBGColor,
);
}
@@ -1065,3 +1091,16 @@ TextAlign _buildTextAlignInTableCell(
return node.tableAlign.textAlign;
}
+
+extension on Node {
+ bool get isInQuote {
+ Node? parent = this.parent;
+ while (parent != null) {
+ if (parent.type == QuoteBlockKeys.type) {
+ return true;
+ }
+ parent = parent.parent;
+ }
+ return false;
+ }
+}
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 2f2b2b0aa2..83e300146e 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
@@ -154,7 +154,10 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage>
InlineMathEquationKeys.formula,
]);
- indentableBlockTypes.add(ToggleListBlockKeys.type);
+ indentableBlockTypes.addAll([
+ ToggleListBlockKeys.type,
+ CalloutBlockKeys.type,
+ ]);
convertibleBlockTypes.addAll([
ToggleListBlockKeys.type,
CalloutBlockKeys.type,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_cubit.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_cubit.dart
index 52b518a718..733da3fd71 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_cubit.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_cubit.dart
@@ -10,7 +10,8 @@ import 'package:appflowy/workspace/application/view/prelude.dart';
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockKeys, quoteNode;
import 'package:flutter_bloc/flutter_bloc.dart';
class BlockActionOptionState {}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/drag_to_reorder/util.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/drag_to_reorder/util.dart
index 2e56331faf..da06bdc52b 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/drag_to_reorder/util.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/drag_to_reorder/util.dart
@@ -1,7 +1,8 @@
import 'package:appflowy/plugins/document/presentation/editor_plugins/columns/simple_columns_block_constant.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockKeys, quoteNode;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/option_actions.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/option_actions.dart
index 14ec6773a6..571cb4baa0 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/option_actions.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/option_actions.dart
@@ -1,7 +1,8 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.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 QuoteBlockKeys, quoteNode;
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
import 'package:easy_localization/easy_localization.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/turn_into_option_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/turn_into_option_action.dart
index ac3774a511..c69233e440 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/turn_into_option_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/turn_into_option_action.dart
@@ -5,7 +5,8 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.da
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockKeys, quoteNode;
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart
index 81a52adb69..3835ff7fd4 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart
@@ -66,6 +66,10 @@ class AIWriterBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -83,6 +87,7 @@ class AiWriterBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
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 1d9f70254f..45a5a93ac8 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
@@ -9,7 +9,6 @@ import 'package:easy_localization/easy_localization.dart' hide TextDirection;
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
-import 'package:provider/provider.dart';
import 'package:universal_platform/universal_platform.dart';
import '../base/emoji_picker_button.dart';
@@ -80,7 +79,7 @@ class CalloutBlockComponentBuilder extends BlockComponentBuilder {
});
final Color defaultColor;
- final EdgeInsets inlinePadding;
+ final EdgeInsets Function(Node node) inlinePadding;
@override
BlockComponentWidget build(BlockComponentContext blockComponentContext) {
@@ -96,12 +95,15 @@ class CalloutBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@override
- BlockComponentValidate get validate =>
- (node) => node.delta != null && node.children.isEmpty;
+ BlockComponentValidate get validate => (node) => node.delta != null;
}
// the main widget for rendering the callout block
@@ -111,13 +113,14 @@ class CalloutBlockComponentWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
required this.defaultColor,
required this.inlinePadding,
});
final Color defaultColor;
- final EdgeInsets inlinePadding;
+ final EdgeInsets Function(Node node) inlinePadding;
@override
State<CalloutBlockComponentWidget> createState() =>
@@ -132,7 +135,8 @@ class _CalloutBlockComponentWidgetState
BlockComponentConfigurable,
BlockComponentTextDirectionMixin,
BlockComponentAlignMixin,
- BlockComponentBackgroundColorMixin {
+ BlockComponentBackgroundColorMixin,
+ NestedBlockComponentStatefulWidgetMixin {
// the key used to forward focus to the richtext child
@override
final forwardKey = GlobalKey(debugLabel: 'flowy_rich_text');
@@ -170,21 +174,45 @@ class _CalloutBlockComponentWidgetState
try {
result = EmojiIconData(FlowyIconType.values.byName(type), icon);
} catch (e) {
- Log.error(
- 'get emoji error with icon:[$icon], type:[$type] within alloutBlockComponentWidget',
+ Log.info(
+ 'get emoji error with icon:[$icon], type:[$type] within calloutBlockComponentWidget',
e,
);
}
return result;
}
- // get access to the editor state via provider
@override
- late final editorState = Provider.of<EditorState>(context, listen: false);
+ Widget buildComponentWithChildren(BuildContext context) {
+ return Stack(
+ children: [
+ Positioned.fill(
+ left: cachedLeft,
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: const BorderRadius.all(Radius.circular(6.0)),
+ color: backgroundColor,
+ ),
+ ),
+ ),
+ NestedListWidget(
+ indentPadding: indentPadding.copyWith(bottom: 8),
+ child: buildComponent(context, withBackgroundColor: false),
+ children: editorState.renderer.buildList(
+ context,
+ widget.node.children,
+ ),
+ ),
+ ],
+ );
+ }
// build the callout block widget
@override
- Widget build(BuildContext context) {
+ Widget buildComponent(
+ BuildContext context, {
+ bool withBackgroundColor = true,
+ }) {
final textDirection = calculateTextDirection(
layoutDirection: Directionality.maybeOf(context),
);
@@ -192,10 +220,10 @@ class _CalloutBlockComponentWidgetState
Widget child = Container(
decoration: BoxDecoration(
- borderRadius: const BorderRadius.all(Radius.circular(8.0)),
+ borderRadius: const BorderRadius.all(Radius.circular(6.0)),
color: backgroundColor,
),
- padding: widget.inlinePadding,
+ padding: widget.inlinePadding(widget.node),
width: double.infinity,
alignment: alignment,
child: Row(
@@ -203,7 +231,7 @@ class _CalloutBlockComponentWidgetState
mainAxisSize: MainAxisSize.min,
textDirection: textDirection,
children: [
- if (UniversalPlatform.isDesktopOrWeb) const HSpace(4.0),
+ if (UniversalPlatform.isDesktopOrWeb) const HSpace(6.0),
// the emoji picker button for the note
EmojiPickerButton(
// force to refresh the popover state
@@ -222,7 +250,7 @@ class _CalloutBlockComponentWidgetState
if (!r.keepOpen) controller?.close();
},
),
- if (UniversalPlatform.isDesktopOrWeb) const HSpace(4.0),
+ if (UniversalPlatform.isDesktopOrWeb) const HSpace(6.0),
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
@@ -236,7 +264,7 @@ class _CalloutBlockComponentWidgetState
child = Padding(
key: blockComponentKey,
- padding: padding,
+ padding: EdgeInsets.zero,
child: child,
);
@@ -245,6 +273,7 @@ class _CalloutBlockComponentWidgetState
delegate: this,
listenable: editorState.selectionNotifier,
blockColor: editorState.editorStyle.selectionColor,
+ selectionAboveBlock: true,
supportTypes: const [
BlockSelectionType.block,
],
@@ -255,6 +284,7 @@ class _CalloutBlockComponentWidgetState
child = BlockComponentActionWrapper(
node: widget.node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_shortcuts.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_shortcuts.dart
index 3c50661071..482364bbb5 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_shortcuts.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_shortcuts.dart
@@ -33,8 +33,20 @@ CharacterShortcutEventHandler _insertNewLineHandler = (editorState) async {
if (HardwareKeyboard.instance.isShiftPressed) {
await editorState.insertNewLine();
- } else {
- await editorState.insertTextAtCurrentSelection('\n');
+ } else if (node.children.isEmpty) {
+ // insert a new paragraph within the callout block
+ final path = node.path.child(0);
+ final transaction = editorState.transaction;
+ transaction.insertNode(
+ path,
+ paragraphNode(),
+ );
+ transaction.afterSelection = Selection.collapsed(
+ Position(
+ path: path,
+ ),
+ );
+ await editorState.apply(transaction);
}
return true;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_component.dart
index 611f7ec67f..eaaffa3479 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_column_block_component.dart
@@ -51,6 +51,7 @@ class SimpleColumnBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_columns_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_columns_block_component.dart
index 43fd779d33..2761d8eabb 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_columns_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/columns/simple_columns_block_component.dart
@@ -67,6 +67,7 @@ class ColumnsBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
index 86df2ae172..87c2815091 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
@@ -42,6 +42,10 @@ class DatabaseViewBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -58,6 +62,7 @@ class DatabaseBlockComponentWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/error/error_block_component_builder.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/error/error_block_component_builder.dart
index a37ed29150..4394ff57c6 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/error/error_block_component_builder.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/error/error_block_component_builder.dart
@@ -30,6 +30,10 @@ class ErrorBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -43,6 +47,7 @@ class ErrorBlockComponentWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
@@ -81,6 +86,7 @@ class _ErrorBlockComponentWidgetState extends State<ErrorBlockComponentWidget>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_block_component.dart
index 52fc2e717f..afd8188cac 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/file/file_block_component.dart
@@ -141,6 +141,7 @@ class FileBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
@@ -303,6 +304,7 @@ class FileBlockComponentState extends State<FileBlockComponent>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/custom_image_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/custom_image_block_component.dart
index 0471358464..5d544f535a 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/custom_image_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component/custom_image_block_component.dart
@@ -123,6 +123,7 @@ class CustomImageBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
this.showMenu = false,
this.menuBuilder,
@@ -235,6 +236,7 @@ class CustomImageBlockComponentState extends State<CustomImageBlockComponent>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart
index 88f60db494..51da975938 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/multi_image_block_component/multi_image_block_component.dart
@@ -82,6 +82,7 @@ class MultiImageBlockComponent extends BlockComponentStatefulWidget {
this.menuBuilder,
super.configuration = const BlockComponentConfiguration(),
super.actionBuilder,
+ super.actionTrailingBuilder,
});
final bool showMenu;
@@ -190,6 +191,7 @@ class MultiImageBlockComponentState extends State<MultiImageBlockComponent>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
index e9d6b3297e..2f724061ee 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
@@ -79,6 +79,10 @@ class MathEquationBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -94,6 +98,7 @@ class MathEquationBlockComponentWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
@@ -157,6 +162,7 @@ class MathEquationBlockComponentWidgetState
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/migration/editor_migration.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/migration/editor_migration.dart
index be9063a6c8..41bb8ce873 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/migration/editor_migration.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/migration/editor_migration.dart
@@ -7,7 +7,8 @@ import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy/workspace/application/view/view_service.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockComponentBuilder, quoteNode, QuoteBlockKeys;
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
import 'package:collection/collection.dart';
import 'package:string_validator/string_validator.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_block_items.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_block_items.dart
index 57670afadd..8e1a8533e0 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_block_items.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_block_items.dart
@@ -6,7 +6,8 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/mobile_too
import 'package:appflowy/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_popup_menu.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/aa_menu/_toolbar_theme.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 QuoteBlockKeys, quoteNode;
import 'package:collection/collection.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_menu_item_builder.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_menu_item_builder.dart
index 4ae243575c..b3df4dfd39 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_menu_item_builder.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_menu_item_builder.dart
@@ -12,7 +12,8 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.da
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/startup/tasks/app_widget.dart';
import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide QuoteBlockComponentBuilder, quoteNode, QuoteBlockKeys;
import 'package:appflowy_editor_plugins/appflowy_editor_plugins.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/numbered_list/numbered_list_icon.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/numbered_list/numbered_list_icon.dart
index 2f31a68a73..3fad80bf32 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/numbered_list/numbered_list_icon.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/numbered_list/numbered_list_icon.dart
@@ -29,7 +29,7 @@ class NumberedListIcon extends StatelessWidget {
);
return Padding(
- padding: const EdgeInsets.only(right: 8.0),
+ padding: const EdgeInsets.only(left: 6.0, right: 10.0),
child: Text(
node.levelString,
style: adjustedTextStyle,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
index eaacb43ea6..023ff739ed 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
@@ -52,6 +52,10 @@ class OutlineBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -65,6 +69,7 @@ class OutlineBlockWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
@@ -102,6 +107,7 @@ class _OutlineBlockWidgetState extends State<OutlineBlockWidget>
child = BlockComponentActionWrapper(
node: widget.node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_block/custom_page_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_block/custom_page_block_component.dart
index 5d7028f6e1..731ba4c7cd 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_block/custom_page_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_block/custom_page_block_component.dart
@@ -25,6 +25,7 @@ class CustomPageBlockComponent extends BlockComponentStatelessWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
this.header,
this.footer,
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.dart
index 8a475fd5a0..63aaf34e8d 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
@@ -63,6 +63,7 @@ export 'outline/outline_block_component.dart';
export 'parsers/document_markdown_parsers.dart';
export 'parsers/markdown_parsers.dart';
export 'parsers/markdown_simple_table_parser.dart';
+export 'quote/quote_block_component.dart';
export 'quote/quote_block_shortcuts.dart';
export 'shortcuts/character_shortcuts.dart';
export 'shortcuts/command_shortcuts.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_component.dart
new file mode 100644
index 0000000000..28729e64a6
--- /dev/null
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/quote/quote_block_component.dart
@@ -0,0 +1,304 @@
+import 'dart:async';
+
+import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:flutter/material.dart';
+import 'package:provider/provider.dart';
+
+typedef QuoteBlockIconBuilder = Widget Function(
+ BuildContext context,
+ Node node,
+);
+
+class QuoteBlockKeys {
+ const QuoteBlockKeys._();
+
+ static const String type = 'quote';
+
+ static const String delta = blockComponentDelta;
+
+ static const String backgroundColor = blockComponentBackgroundColor;
+
+ static const String textDirection = blockComponentTextDirection;
+}
+
+Node quoteNode({
+ Delta? delta,
+ String? textDirection,
+ Attributes? attributes,
+ Iterable<Node>? children,
+}) {
+ attributes ??= {'delta': (delta ?? Delta()).toJson()};
+ return Node(
+ type: QuoteBlockKeys.type,
+ attributes: {
+ ...attributes,
+ if (textDirection != null) QuoteBlockKeys.textDirection: textDirection,
+ },
+ children: children ?? [],
+ );
+}
+
+class QuoteBlockComponentBuilder extends BlockComponentBuilder {
+ QuoteBlockComponentBuilder({
+ super.configuration,
+ this.iconBuilder,
+ });
+
+ final QuoteBlockIconBuilder? iconBuilder;
+
+ @override
+ BlockComponentWidget build(BlockComponentContext blockComponentContext) {
+ final node = blockComponentContext.node;
+ return QuoteBlockComponentWidget(
+ key: node.key,
+ node: node,
+ configuration: configuration,
+ iconBuilder: iconBuilder,
+ showActions: showActions(node),
+ actionBuilder: (context, state) => actionBuilder(
+ blockComponentContext,
+ state,
+ ),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
+ );
+ }
+
+ @override
+ BlockComponentValidate get validate => (node) => node.delta != null;
+}
+
+class QuoteBlockComponentWidget extends BlockComponentStatefulWidget {
+ const QuoteBlockComponentWidget({
+ super.key,
+ required super.node,
+ super.showActions,
+ super.actionBuilder,
+ super.actionTrailingBuilder,
+ super.configuration = const BlockComponentConfiguration(),
+ this.iconBuilder,
+ });
+
+ final QuoteBlockIconBuilder? iconBuilder;
+
+ @override
+ State<QuoteBlockComponentWidget> createState() =>
+ _QuoteBlockComponentWidgetState();
+}
+
+class _QuoteBlockComponentWidgetState extends State<QuoteBlockComponentWidget>
+ with
+ SelectableMixin,
+ DefaultSelectableMixin,
+ BlockComponentConfigurable,
+ BlockComponentBackgroundColorMixin,
+ BlockComponentTextDirectionMixin,
+ BlockComponentAlignMixin,
+ NestedBlockComponentStatefulWidgetMixin {
+ @override
+ final forwardKey = GlobalKey(debugLabel: 'flowy_rich_text');
+
+ @override
+ GlobalKey<State<StatefulWidget>> get containerKey => widget.node.key;
+
+ @override
+ GlobalKey<State<StatefulWidget>> blockComponentKey = GlobalKey(
+ debugLabel: QuoteBlockKeys.type,
+ );
+
+ @override
+ BlockComponentConfiguration get configuration => widget.configuration;
+
+ @override
+ Node get node => widget.node;
+
+ ValueNotifier<double> quoteBlockHeightNotifier = ValueNotifier(0);
+
+ StreamSubscription<EditorTransactionValue>? _transactionSubscription;
+
+ final GlobalKey layoutBuilderKey = GlobalKey();
+
+ @override
+ void initState() {
+ super.initState();
+
+ _observerQuoteBlockChanges();
+ }
+
+ @override
+ void dispose() {
+ _transactionSubscription?.cancel();
+
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ _updateQuoteBlockHeight();
+
+ return KeyedSubtree(
+ key: layoutBuilderKey,
+ child: node.children.isEmpty
+ ? buildComponent(context)
+ : buildComponentWithChildren(context),
+ );
+ },
+ );
+ }
+
+ @override
+ Widget buildComponent(
+ BuildContext context, {
+ bool withBackgroundColor = true,
+ }) {
+ final textDirection = calculateTextDirection(
+ layoutDirection: Directionality.maybeOf(context),
+ );
+
+ Widget child = AppFlowyRichText(
+ key: forwardKey,
+ delegate: this,
+ node: widget.node,
+ editorState: editorState,
+ textAlign: alignment?.toTextAlign ?? textAlign,
+ placeholderText: placeholderText,
+ textSpanDecorator: (textSpan) => textSpan.updateTextStyle(
+ textStyleWithTextSpan(textSpan: textSpan),
+ ),
+ placeholderTextSpanDecorator: (textSpan) => textSpan.updateTextStyle(
+ placeholderTextStyleWithTextSpan(textSpan: textSpan),
+ ),
+ textDirection: textDirection,
+ cursorColor: editorState.editorStyle.cursorColor,
+ selectionColor: editorState.editorStyle.selectionColor,
+ cursorWidth: editorState.editorStyle.cursorWidth,
+ );
+
+ child = Container(
+ width: double.infinity,
+ alignment: alignment,
+ child: IntrinsicHeight(
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ textDirection: textDirection,
+ children: [
+ widget.iconBuilder != null
+ ? widget.iconBuilder!(context, node)
+ : ValueListenableBuilder<double>(
+ valueListenable: quoteBlockHeightNotifier,
+ builder: (context, height, child) {
+ return QuoteIcon(height: height);
+ },
+ ),
+ Flexible(
+ child: child,
+ ),
+ ],
+ ),
+ ),
+ );
+
+ child = Container(
+ color: backgroundColor,
+ child: Padding(
+ key: blockComponentKey,
+ padding: padding,
+ child: child,
+ ),
+ );
+
+ child = BlockSelectionContainer(
+ node: node,
+ delegate: this,
+ listenable: editorState.selectionNotifier,
+ remoteSelection: editorState.remoteSelections,
+ blockColor: editorState.editorStyle.selectionColor,
+ supportTypes: const [
+ BlockSelectionType.block,
+ ],
+ child: child,
+ );
+
+ if (widget.showActions && widget.actionBuilder != null) {
+ child = BlockComponentActionWrapper(
+ node: node,
+ actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
+ child: child,
+ );
+ }
+
+ return child;
+ }
+
+ void _updateQuoteBlockHeight() {
+ WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
+ final renderObject = layoutBuilderKey.currentContext?.findRenderObject();
+ if (renderObject != null && renderObject is RenderBox) {
+ quoteBlockHeightNotifier.value =
+ renderObject.size.height - padding.top * 2;
+ } else {
+ quoteBlockHeightNotifier.value = 0;
+ }
+ });
+ }
+
+ void _observerQuoteBlockChanges() {
+ _transactionSubscription = editorState.transactionStream.listen((event) {
+ final time = event.$1;
+
+ if (time != TransactionTime.before) {
+ return;
+ }
+
+ final transaction = event.$2;
+ final operations = transaction.operations;
+ for (final operation in operations) {
+ if (node.path.isAncestorOf(operation.path)) {
+ _updateQuoteBlockHeight();
+ }
+ }
+ });
+ }
+}
+
+class QuoteIcon extends StatelessWidget {
+ const QuoteIcon({
+ super.key,
+ this.height = 0,
+ });
+
+ final double height;
+
+ @override
+ Widget build(BuildContext context) {
+ final textScaleFactor =
+ context.read<EditorState>().editorStyle.textScaleFactor;
+ return Container(
+ alignment: Alignment.center,
+ constraints:
+ const BoxConstraints(minWidth: 22, minHeight: 22, maxHeight: 22) *
+ textScaleFactor,
+ padding: const EdgeInsets.only(right: 6.0),
+ child: SizedBox(
+ width: 3 * textScaleFactor,
+
+ // use overflow box to ensure the container can overflow the height so that the children of the quote block can have the quote
+ child: OverflowBox(
+ alignment: Alignment.topCenter,
+ maxHeight: height,
+ child: Container(
+ width: 3 * textScaleFactor,
+ height: height,
+ color: Theme.of(context).colorScheme.primary,
+ ),
+ ),
+ ),
+ );
+ }
+}
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.dart
index ba3ad6e7df..835d7bb47a 100644
--- 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.dart
@@ -31,8 +31,20 @@ CharacterShortcutEventHandler _insertNewLineHandler = (editorState) async {
if (HardwareKeyboard.instance.isShiftPressed) {
await editorState.insertNewLine();
- } else {
- await editorState.insertTextAtCurrentSelection('\n');
+ } else if (node.children.isEmpty) {
+ // insert a new paragraph within the callout block
+ final path = node.path.child(0);
+ final transaction = editorState.transaction;
+ transaction.insertNode(
+ path,
+ paragraphNode(),
+ );
+ transaction.afterSelection = Selection.collapsed(
+ Position(
+ path: path,
+ ),
+ );
+ await editorState.apply(transaction);
}
return true;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_block_component.dart
index 5d4c3cab52..ee6020793c 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_block_component.dart
@@ -161,6 +161,10 @@ class SimpleTableBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -174,6 +178,7 @@ class SimpleTableBlockWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
required this.alwaysDistributeColumnWidths,
});
@@ -262,6 +267,7 @@ class _SimpleTableBlockWidgetState extends State<SimpleTableBlockWidget>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart
index 112343c6d8..29b3c3455f 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_cell_block_component.dart
@@ -47,6 +47,10 @@ class SimpleTableCellBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -60,6 +64,7 @@ class SimpleTableCellBlockWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
required this.alwaysDistributeColumnWidths,
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_row_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_row_block_component.dart
index d61d371e1b..99f23d1ee9 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_row_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_row_block_component.dart
@@ -39,6 +39,10 @@ class SimpleTableRowBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -52,6 +56,7 @@ class SimpleTableRowBlockWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
required this.alwaysDistributeColumnWidths,
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/sub_page_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/sub_page_block_component.dart
index ad69d4c784..0ce2b74a74 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/sub_page_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/sub_page/sub_page_block_component.dart
@@ -73,6 +73,7 @@ class SubPageBlockComponent extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
});
@@ -295,6 +296,7 @@ class SubPageBlockComponentState extends State<SubPageBlockComponent>
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
index 9fc0a02cec..9e93f80ce4 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
@@ -111,6 +111,10 @@ class ToggleListBlockComponentBuilder extends BlockComponentBuilder {
blockComponentContext,
state,
),
+ actionTrailingBuilder: (context, state) => actionTrailingBuilder(
+ blockComponentContext,
+ state,
+ ),
);
}
@@ -124,6 +128,7 @@ class ToggleListBlockComponentWidget extends BlockComponentStatefulWidget {
required super.node,
super.showActions,
super.actionBuilder,
+ super.actionTrailingBuilder,
super.configuration = const BlockComponentConfiguration(),
this.padding = const EdgeInsets.all(0),
this.textStyleBuilder,
@@ -247,6 +252,7 @@ class _ToggleListBlockComponentWidgetState
child = BlockComponentActionWrapper(
node: node,
actionBuilder: widget.actionBuilder!,
+ actionTrailingBuilder: widget.actionTrailingBuilder,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock
index fc04deae5b..c29671f625 100644
--- a/frontend/appflowy_flutter/pubspec.lock
+++ b/frontend/appflowy_flutter/pubspec.lock
@@ -90,8 +90,8 @@ packages:
dependency: "direct main"
description:
path: "."
- ref: e2c9713
- resolved-ref: e2c9713104f00658c83ac7d1657e7a0fade171ad
+ ref: "63e92c1"
+ resolved-ref: "63e92c19f506dab795d6e1829f82e63a073e7f11"
url: "https://github.com/AppFlowy-IO/appflowy-editor.git"
source: git
version: "5.1.0"
diff --git a/frontend/appflowy_flutter/pubspec.yaml b/frontend/appflowy_flutter/pubspec.yaml
index f70f88ede7..29cf86decf 100644
--- a/frontend/appflowy_flutter/pubspec.yaml
+++ b/frontend/appflowy_flutter/pubspec.yaml
@@ -180,7 +180,7 @@ dependency_overrides:
appflowy_editor:
git:
url: https://github.com/AppFlowy-IO/appflowy-editor.git
- ref: "e2c9713"
+ ref: "63e92c1"
appflowy_editor_plugins:
git:
diff --git a/frontend/appflowy_flutter/test/unit_test/document/turn_into/turn_into_test.dart b/frontend/appflowy_flutter/test/unit_test/document/turn_into/turn_into_test.dart
index 387375c286..d4b0bfa45c 100644
--- a/frontend/appflowy_flutter/test/unit_test/document/turn_into/turn_into_test.dart
+++ b/frontend/appflowy_flutter/test/unit_test/document/turn_into/turn_into_test.dart
@@ -1,7 +1,8 @@
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/block_action_option_cubit.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:appflowy_editor/appflowy_editor.dart'
+ hide quoteNode, QuoteBlockKeys;
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';