mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: #1763 [Bug] Mouse unable to click a certain area
This commit is contained in:
parent
5de3912fe3
commit
fb30989cf8
@ -23,7 +23,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "type": "text", "delta": [] },
|
{ "type": "text", "delta": [] },
|
||||||
{ "type": "board" },
|
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"delta": [
|
"delta": [
|
||||||
|
@ -80,6 +80,7 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =
|
|||||||
final transaction = editorState.transaction
|
final transaction = editorState.transaction
|
||||||
..updateNode(textNode, {
|
..updateNode(textNode, {
|
||||||
BuiltInAttributeKey.subtype: null,
|
BuiltInAttributeKey.subtype: null,
|
||||||
|
textNode.subtype!: null,
|
||||||
})
|
})
|
||||||
..afterSelection = afterSelection;
|
..afterSelection = afterSelection;
|
||||||
editorState.apply(transaction);
|
editorState.apply(transaction);
|
||||||
|
@ -77,7 +77,12 @@ class AppFlowyRenderPlugin extends AppFlowyRenderPluginService {
|
|||||||
return _autoUpdateNodeWidget(builder, context);
|
return _autoUpdateNodeWidget(builder, context);
|
||||||
} else {
|
} else {
|
||||||
// Returns a SizeBox with 0 height if no builder found.
|
// 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,
|
height: 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||||
import 'package:appflowy_editor/src/extensions/text_node_extensions.dart';
|
import 'package:appflowy_editor/src/extensions/text_node_extensions.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import '../../infra/test_editor.dart';
|
import '../../infra/test_editor.dart';
|
||||||
|
|
||||||
@ -67,5 +68,61 @@ void main() async {
|
|||||||
expect(node.allSatisfyUnderlineInSelection(selection), true);
|
expect(node.allSatisfyUnderlineInSelection(selection), true);
|
||||||
expect(node.allSatisfyStrikethroughInSelection(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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user