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.

fix: simple table issues on mobile (#7068)

Lucascb2b9ac537be
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
index aa6661a834..999813d63e 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
@@ -57,6 +57,7 @@ Future<T?> showMobileBottomSheet<T>(
double maxChildSize = 0.8,
double initialChildSize = 0.51,
double bottomSheetPadding = 0,
+ bool enablePadding = true,
}) async {
assert(
showHeader ||
@@ -172,14 +173,18 @@ Future<T?> showMobileBottomSheet<T>(
}
// ----- content area -----
- // add content padding and extra bottom padding
- children.add(
- Padding(
- padding:
- padding + EdgeInsets.only(bottom: context.bottomSheetPadding()),
- child: child,
- ),
- );
+ if (enablePadding) {
+ // add content padding and extra bottom padding
+ children.add(
+ Padding(
+ padding:
+ padding + EdgeInsets.only(bottom: context.bottomSheetPadding()),
+ child: child,
+ ),
+ );
+ } else {
+ children.add(child);
+ }
// ----- content area -----
if (children.length == 1) {
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 c1fa69913c..1d10c1f161 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart
@@ -529,6 +529,11 @@ HeadingBlockComponentBuilder _buildHeadingBlockComponentBuilder(
) {
return HeadingBlockComponentBuilder(
configuration: configuration.copyWith(
+ textStyle: (node) => _buildTextStyleInTableCell(
+ context,
+ node: node,
+ configuration: configuration,
+ ),
padding: (node) {
if (customHeadingPadding != null) {
return customHeadingPadding;
@@ -567,7 +572,9 @@ HeadingBlockComponentBuilder _buildHeadingBlockComponentBuilder(
configuration: configuration,
),
),
- textStyleBuilder: (level) => styleCustomizer.headingStyleBuilder(level),
+ textStyleBuilder: (level) {
+ return styleCustomizer.headingStyleBuilder(level);
+ },
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/align_option_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/align_option_action.dart
index 7f91f7e2b0..efa1c3e15c 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/align_option_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option/align_option_action.dart
@@ -27,11 +27,11 @@ enum OptionAlignType {
FlowySvgData get svg {
switch (this) {
case OptionAlignType.left:
- return FlowySvgs.align_left_s;
+ return FlowySvgs.table_align_left_s;
case OptionAlignType.center:
- return FlowySvgs.align_center_s;
+ return FlowySvgs.table_align_center_s;
case OptionAlignType.right:
- return FlowySvgs.align_right_s;
+ return FlowySvgs.table_align_right_s;
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
index b2190d67fa..e1df115e15 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
@@ -173,8 +173,8 @@ class _MentionDateBlockState extends State<MentionDateBlock> {
},
child: MouseRegion(
cursor: SystemMouseCursors.click,
- child: Row(
- mainAxisSize: MainAxisSize.min,
+ child: Wrap(
+ crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text(
'@$formattedDate',
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
index f102c10daf..7ca8f6b140 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
@@ -10,6 +10,7 @@ import 'package:appflowy/plugins/trash/application/trash_service.dart';
import 'package:appflowy/shared/clipboard_state.dart';
import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
import 'package:appflowy/startup/startup.dart';
+import 'package:appflowy/util/string_extension.dart';
import 'package:appflowy/workspace/application/action_navigation/action_navigation_bloc.dart';
import 'package:appflowy/workspace/application/action_navigation/navigation_action.dart';
import 'package:appflowy/workspace/application/view/prelude.dart';
@@ -510,7 +511,10 @@ class _MentionPageBlockContent extends StatelessWidget {
);
if (blockContent == null || blockContent.isEmpty) {
- return shouldDisplayViewName ? view.name : '';
+ return shouldDisplayViewName
+ ? view.name
+ .orDefault(LocaleKeys.menuAppHeader_defaultNewPageName.tr())
+ : '';
}
return shouldDisplayViewName
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 fa35c6460f..f234440169 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
@@ -456,7 +456,7 @@ class SimpleTableCellBlockWidgetState extends State<SimpleTableCellBlockWidget>
return context.simpleTableDefaultHeaderColor;
}
- return Theme.of(context).colorScheme.surface;
+ return Colors.transparent;
}
bool _isInHeader() {
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart
index 0f531b1c91..559b4d202d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_constants.dart
@@ -269,6 +269,8 @@ class SimpleTableConstants {
static const actionSheetContentSectionHeight = 44.0;
static const actionSheetNormalActionSectionHeight = 48.0;
static const actionSheetButtonRadius = 12.0;
+
+ static const actionSheetBottomSheetHeight = 320.0;
}
enum SimpleTableBorderRenderType {
@@ -308,4 +310,7 @@ extension SimpleTableColors on BuildContext {
Color get simpleTableInsertActionBackgroundColor => Theme.of(this).isLightMode
? const Color(0xFFF2F2F7)
: const Color(0xFF2D3036);
+
+ Color? get simpleTableQuickActionBackgroundColor =>
+ Theme.of(this).isLightMode ? null : const Color(0xFFBBC3CD);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart
index 8b4e2f5153..be82ee3627 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_more_action.dart
@@ -438,6 +438,8 @@ class SimpleTableActionMenu extends StatelessWidget {
return;
}
+ final beforeSelection = editorState.selection;
+
// increase the keep editor focus notifier to prevent the editor from losing focus
keepEditorFocusNotifier.increase();
@@ -469,6 +471,8 @@ class SimpleTableActionMenu extends StatelessWidget {
context,
showDragHandle: true,
showDivider: false,
+ useSafeArea: false,
+ enablePadding: false,
builder: (context) => Provider.value(
value: simpleTableContext,
child: SimpleTableBottomSheet(
@@ -482,7 +486,13 @@ class SimpleTableActionMenu extends StatelessWidget {
keepEditorFocusNotifier.decrease();
// remove the extra info
- editorState.selectionType = null;
- editorState.selectionExtraInfo = null;
+ if (beforeSelection != null) {
+ await editorState.updateSelectionWithReason(
+ beforeSelection,
+ customSelectionType: SelectionType.inline,
+ reason: SelectionUpdateReason.uiEvent,
+ extraInfo: {},
+ );
+ }
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_content_operation.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_content_operation.dart
index 9691a57a0d..c545036f35 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_content_operation.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_content_operation.dart
@@ -137,8 +137,8 @@ extension TableContentOperation on EditorState {
final cell = columnIndex >= row.children.length
? row.children.last
: row.children[columnIndex];
- final startNode = cell.getFirstChildIndex();
- final endNode = cell.getLastChildIndex();
+ final startNode = cell.getFirstFocusableChild();
+ final endNode = cell.getLastFocusableChild();
if (startNode == null || endNode == null) {
continue;
}
@@ -200,8 +200,8 @@ extension TableContentOperation on EditorState {
final row = tableNode.children[rowIndex];
for (var i = 0; i < row.children.length; i++) {
final cell = row.children[i];
- final startNode = cell.getFirstChildIndex();
- final endNode = cell.getLastChildIndex();
+ final startNode = cell.getFirstFocusableChild();
+ final endNode = cell.getLastFocusableChild();
if (startNode == null || endNode == null) {
continue;
}
@@ -255,8 +255,8 @@ extension TableContentOperation on EditorState {
final row = tableNode.children[i];
for (var j = 0; j < row.children.length; j++) {
final cell = row.children[j];
- final startNode = cell.getFirstChildIndex();
- final endNode = cell.getLastChildIndex();
+ final startNode = cell.getFirstFocusableChild();
+ final endNode = cell.getLastFocusableChild();
if (startNode == null || endNode == null) {
continue;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_node_extension.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_node_extension.dart
index ff2cd3e674..0987bc29d3 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_node_extension.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_node_extension.dart
@@ -805,21 +805,21 @@ extension TableNodeExtension on Node {
/// Get first focusable child in the table cell.
///
/// If the current node is not a table cell node, it will return null.
- Node? getFirstChildIndex() {
+ Node? getFirstFocusableChild() {
if (children.isEmpty) {
return this;
}
- return children.first.getFirstChildIndex();
+ return children.first.getFirstFocusableChild();
}
/// Get last focusable child in the table cell.
///
/// If the current node is not a table cell node, it will return null.
- Node? getLastChildIndex() {
+ Node? getLastFocusableChild() {
if (children.isEmpty) {
return this;
}
- return children.last.getLastChildIndex();
+ return children.last.getLastFocusableChild();
}
/// Get table align of column
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_arrow_down_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_arrow_down_command.dart
index 68e2a1f879..70b2b07660 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_arrow_down_command.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_arrow_down_command.dart
@@ -1,5 +1,7 @@
-import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_command_extension.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_block_component.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_operations.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_command_extension.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_navigation_command.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
@@ -40,6 +42,7 @@ KeyEventResult _arrowDownInTableCellHandler(EditorState editorState) {
if (rowIndex == parentTableNode.rowLength - 1) {
// focus on the next block
final nextNode = tableCellNode.next;
+ final nextBlock = tableCellNode.parentTableNode?.next;
if (nextNode != null) {
final nextFocusableSibling = parentTableNode.getNextFocusableSibling();
if (nextFocusableSibling != null) {
@@ -51,6 +54,16 @@ KeyEventResult _arrowDownInTableCellHandler(EditorState editorState) {
),
);
}
+ } else if (nextBlock != null) {
+ if (nextBlock.type != SimpleTableBlockKeys.type) {
+ newSelection = Selection.collapsed(
+ Position(
+ path: nextBlock.path,
+ ),
+ );
+ } else {
+ return tableNavigationArrowDownCommand.handler(editorState);
+ }
}
} else {
// focus on next cell in the same column
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_commands.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_commands.dart
index 6fca0a5275..1cc278ca99 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_commands.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_commands.dart
@@ -4,10 +4,12 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_tab
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_arrow_up_command.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_backspace_command.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_enter_command.dart';
+import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_navigation_command.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_select_all_command.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_tab_command.dart';
final simpleTableCommands = [
+ tableNavigationArrowDownCommand,
arrowUpInTableCell,
arrowDownInTableCell,
arrowLeftInTableCell,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_navigation_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_navigation_command.dart
new file mode 100644
index 0000000000..534879f56f
--- /dev/null
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_shortcuts/simple_table_navigation_command.dart
@@ -0,0 +1,40 @@
+import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
+import 'package:appflowy_editor/appflowy_editor.dart';
+import 'package:flutter/material.dart';
+
+final CommandShortcutEvent tableNavigationArrowDownCommand =
+ CommandShortcutEvent(
+ key: 'table navigation',
+ getDescription: () => 'table navigation',
+ command: 'arrow down',
+ handler: _tableNavigationArrowDownHandler,
+);
+
+KeyEventResult _tableNavigationArrowDownHandler(EditorState editorState) {
+ final selection = editorState.selection;
+ if (selection == null || !selection.isCollapsed) {
+ return KeyEventResult.ignored;
+ }
+
+ final nextNode = editorState.getNodeAtPath(selection.start.path.next);
+ if (nextNode == null) {
+ return KeyEventResult.ignored;
+ }
+
+ if (nextNode.type == SimpleTableBlockKeys.type) {
+ final firstCell = nextNode.getTableCellNode(rowIndex: 0, columnIndex: 0);
+ if (firstCell != null) {
+ final firstFocusableChild = firstCell.getFirstFocusableChild();
+ if (firstFocusableChild != null) {
+ editorState.updateSelectionWithReason(
+ Selection.collapsed(
+ Position(path: firstFocusableChild.path),
+ ),
+ );
+ return KeyEventResult.handled;
+ }
+ }
+ }
+
+ return KeyEventResult.ignored;
+}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart
index 80fa91e658..2d8b9025cf 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/_simple_table_bottom_sheet_actions.dart
@@ -61,19 +61,12 @@ class SimpleTableCellQuickActions extends ISimpleTableBottomSheetActions {
SimpleTableMoreAction.copy,
),
),
- FutureBuilder(
- future: getIt<ClipboardService>().getData(),
- builder: (context, snapshot) {
- final hasContent = snapshot.data?.tableJson != null;
- return SimpleTableQuickAction(
- type: SimpleTableMoreAction.paste,
- isEnabled: hasContent,
- onTap: () => _onActionTap(
- context,
- SimpleTableMoreAction.paste,
- ),
- );
- },
+ SimpleTableQuickAction(
+ type: SimpleTableMoreAction.paste,
+ onTap: () => _onActionTap(
+ context,
+ SimpleTableMoreAction.paste,
+ ),
),
SimpleTableQuickAction(
type: SimpleTableMoreAction.delete,
@@ -208,8 +201,10 @@ class SimpleTableQuickAction extends StatelessWidget {
onTapUp: isEnabled ? onTap : null,
child: FlowySvg(
type.leftIconSvg,
- blendMode: null,
+ blendMode:
+ type == SimpleTableMoreAction.delete ? null : BlendMode.srcIn,
size: const Size.square(24),
+ color: context.simpleTableQuickActionBackgroundColor,
),
),
);
@@ -538,7 +533,11 @@ class SimpleTableCellActionButtons extends ISimpleTableBottomSheetActions {
}
// close the action menu
- Navigator.of(context).pop();
+ // keep the action menu open if the action is enable header row or enable header column
+ if (action != SimpleTableMoreAction.enableHeaderRow &&
+ action != SimpleTableMoreAction.enableHeaderColumn) {
+ Navigator.of(context).pop();
+ }
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_action_sheet.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_action_sheet.dart
index 46329e643f..269498b341 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_action_sheet.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_action_sheet.dart
@@ -199,8 +199,10 @@ class _SimpleTableMobileReorderButtonState
// show the bottom sheet
await showMobileBottomSheet(
context,
+ useSafeArea: false,
showDragHandle: true,
showDivider: false,
+ enablePadding: false,
builder: (context) => Provider.value(
value: simpleTableContext,
child: SimpleTableCellBottomSheet(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_and_row_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_and_row_button.dart
index b859895c6d..1655920ef5 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_and_row_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_and_row_button.dart
@@ -42,7 +42,12 @@ class SimpleTableAddColumnAndRowHoverButton extends StatelessWidget {
SimpleTableConstants.addColumnAndRowButtonBottomPadding,
right: SimpleTableConstants.addColumnButtonPadding,
child: SimpleTableAddColumnAndRowButton(
- onTap: () => editorState.addColumnAndRowInTable(node),
+ onTap: () {
+ // cancel the selection to avoid flashing the selection
+ editorState.selection = null;
+
+ editorState.addColumnAndRowInTable(node);
+ },
),
)
: const SizedBox.shrink();
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_button.dart
index 5747125b22..29a24ba623 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_column_button.dart
@@ -81,8 +81,12 @@ class _SimpleTableAddColumnHoverButtonState
child: Opacity(
opacity: shouldShow ? 1.0 : 0.0,
child: SimpleTableAddColumnButton(
- onTap: () =>
- widget.editorState.addColumnInTable(widget.tableNode),
+ onTap: () {
+ // cancel the selection to avoid flashing the selection
+ widget.editorState.selection = null;
+
+ widget.editorState.addColumnInTable(widget.tableNode);
+ },
onHorizontalDragStart: (details) {
context.read<SimpleTableContext>().isDraggingColumn = true;
startDraggingOffset = details.globalPosition;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_row_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_row_button.dart
index f0037bd0af..00ca444afd 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_row_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_add_row_button.dart
@@ -87,9 +87,14 @@ class _SimpleTableAddRowHoverButtonState
SimpleTableConstants.cellBorderWidth,
right: SimpleTableConstants.addRowButtonRightPadding,
child: SimpleTableAddRowButton(
- onTap: () => widget.editorState.addRowInTable(
- widget.tableNode,
- ),
+ onTap: () {
+ // cancel the selection to avoid flashing the selection
+ widget.editorState.selection = null;
+
+ widget.editorState.addRowInTable(
+ widget.tableNode,
+ );
+ },
onVerticalDragStart: (details) {
context.read<SimpleTableContext>().isDraggingRow = true;
startDraggingOffset = details.globalPosition;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart
index 5343e73342..644aae1926 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_widgets/simple_table_bottom_sheet.dart
@@ -28,11 +28,13 @@ class SimpleTableCellBottomSheet extends StatefulWidget {
required this.type,
required this.cellNode,
required this.editorState,
+ this.scrollController,
});
final SimpleTableMoreActionType type;
final Node cellNode;
final EditorState editorState;
+ final ScrollController? scrollController;
@override
State<SimpleTableCellBottomSheet> createState() =>
@@ -81,7 +83,9 @@ class _SimpleTableCellBottomSheetState
_buildHeader(),
// content
- ..._buildContent(),
+ ...menuState == _SimpleTableBottomSheetMenuState.cellActionMenu
+ ? _buildScrollableContent()
+ : _buildNonScrollableContent(),
],
);
}
@@ -102,18 +106,51 @@ class _SimpleTableCellBottomSheetState
return BottomSheetHeader(
showBackButton: false,
showCloseButton: true,
- showDoneButton: false,
+ showDoneButton: true,
showRemoveButton: false,
title: widget.type.name.capitalize(),
onClose: () => setState(() {
menuState = _SimpleTableBottomSheetMenuState.cellActionMenu;
}),
+ onDone: (_) => Navigator.pop(context),
);
default:
throw UnimplementedError('Unsupported menu state: $menuState');
}
}
+ List<Widget> _buildScrollableContent() {
+ return [
+ SizedBox(
+ height: SimpleTableConstants.actionSheetBottomSheetHeight,
+ child: Scrollbar(
+ controller: widget.scrollController,
+ child: SingleChildScrollView(
+ controller: widget.scrollController,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ ..._buildContent(),
+
+ // safe area padding
+ VSpace(context.bottomSheetPadding() * 2),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ];
+ }
+
+ List<Widget> _buildNonScrollableContent() {
+ return [
+ ..._buildContent(),
+
+ // safe area padding
+ VSpace(context.bottomSheetPadding()),
+ ];
+ }
+
List<Widget> _buildContent() {
switch (menuState) {
case _SimpleTableBottomSheetMenuState.cellActionMenu:
@@ -296,10 +333,12 @@ class SimpleTableBottomSheet extends StatefulWidget {
super.key,
required this.tableNode,
required this.editorState,
+ this.scrollController,
});
final Node tableNode;
final EditorState editorState;
+ final ScrollController? scrollController;
@override
State<SimpleTableBottomSheet> createState() => _SimpleTableBottomSheetState();
@@ -321,7 +360,24 @@ class _SimpleTableBottomSheetState extends State<SimpleTableBottomSheet> {
_buildHeader(),
// content
- ..._buildContent(),
+ SizedBox(
+ height: SimpleTableConstants.actionSheetBottomSheetHeight,
+ child: Scrollbar(
+ controller: widget.scrollController,
+ child: SingleChildScrollView(
+ controller: widget.scrollController,
+ child: Column(
+ children: [
+ // content
+ ..._buildContent(),
+
+ // safe area padding
+ VSpace(context.bottomSheetPadding() * 2),
+ ],
+ ),
+ ),
+ ),
+ ),
],
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_command.dart
index c20fec9d7d..f8bf2a40a7 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_command.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/slash_menu/slash_command.dart
@@ -108,11 +108,18 @@ Future<bool> _showSlashMenu(
singleColumn: singleColumn,
style: style,
);
+
+ // disable the keyboard service
+ editorState.service.keyboardService?.disable();
+
if (!kIsWeb && Platform.environment.containsKey('FLUTTER_TEST')) {
await _selectionMenuService?.show();
} else {
await _selectionMenuService?.show();
}
+
+ // enable the keyboard service
+ editorState.service.keyboardService?.enable();
}
if (shouldInsertSlash) {