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: #1763 [Bug] Mouse unable to click a certain area

Lucas.Xufb30989cf834
diff --git a/frontend/app_flowy/packages/appflowy_editor/example/assets/example.json b/frontend/app_flowy/packages/appflowy_editor/example/assets/example.json
index ea1a6161da..74c82e3227 100644
--- a/frontend/app_flowy/packages/appflowy_editor/example/assets/example.json
+++ b/frontend/app_flowy/packages/appflowy_editor/example/assets/example.json
@@ -23,7 +23,6 @@
]
},
{ "type": "text", "delta": [] },
- { "type": "board" },
{
"type": "text",
"delta": [
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart
index 41fbb88541..3c7acd16c4 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart
@@ -80,6 +80,7 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =
final transaction = editorState.transaction
..updateNode(textNode, {
BuiltInAttributeKey.subtype: null,
+ textNode.subtype!: null,
})
..afterSelection = afterSelection;
editorState.apply(transaction);
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart
index 0bc3f6049f..e2aec3c4b6 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/render_plugin_service.dart
@@ -77,7 +77,12 @@ class AppFlowyRenderPlugin extends AppFlowyRenderPluginService {
return _autoUpdateNodeWidget(builder, context);
} else {
// Returns a SizeBox with 0 height if no builder found.
- return const SizedBox(
+ assert(
+ false,
+ 'No builder found for node(${node.id}, attributes(${node.attributes})})',
+ );
+ return SizedBox(
+ key: node.key,
height: 0,
);
}
diff --git a/frontend/app_flowy/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart b/frontend/app_flowy/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart
index 721b429df8..e396dbbf03 100644
--- a/frontend/app_flowy/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart
@@ -1,5 +1,6 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/extensions/text_node_extensions.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../infra/test_editor.dart';
@@ -67,5 +68,61 @@ void main() async {
expect(node.allSatisfyUnderlineInSelection(selection), true);
expect(node.allSatisfyStrikethroughInSelection(selection), true);
});
+
+ // https://github.com/AppFlowy-IO/AppFlowy/issues/1763
+ // [Bug] Mouse unable to click a certain area #1763
+ testWidgets('insert a new checkbox after an exsiting checkbox',
+ (tester) async {
+ // Before
+ //
+ // [checkbox] Welcome to Appflowy 😁
+ //
+ // After
+ //
+ // [checkbox] Welcome to Appflowy 😁
+ //
+ // [checkbox] Welcome to Appflowy 😁
+ //
+ const text = 'Welcome to Appflowy 😁';
+ final editor = tester.editor
+ ..insertTextNode(
+ '',
+ attributes: {
+ BuiltInAttributeKey.subtype: BuiltInAttributeKey.checkbox,
+ BuiltInAttributeKey.checkbox: false,
+ },
+ delta: Delta(
+ operations: [TextInsert(text)],
+ ),
+ );
+ await editor.startTesting();
+ await editor.updateSelection(
+ Selection.single(path: [0], startOffset: text.length),
+ );
+
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
+
+ expect(
+ editor.documentSelection,
+ Selection.single(path: [2], startOffset: 0),
+ );
+
+ await editor.pressLogicKey(LogicalKeyboardKey.slash);
+ await tester.pumpAndSettle(const Duration(milliseconds: 1000));
+
+ expect(
+ find.byType(SelectionMenuWidget, skipOffstage: false),
+ findsOneWidget,
+ );
+
+ final checkboxMenuItem = find.text('Checkbox', findRichText: true);
+ await tester.tap(checkboxMenuItem);
+ await tester.pumpAndSettle();
+
+ final checkboxNode = editor.nodeAtPath([2]) as TextNode;
+ expect(checkboxNode.subtype, BuiltInAttributeKey.checkbox);
+ });
});
}