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
Merge remote-tracking branch 'origin/main' into feature/theme
Lucas.Xu5c13b324ecaa
diff --cc frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dartindex bcba14db11,6923e9b531..eafee79a6d--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart@@@ -142,14 -156,9 +156,16 @@@ List<ShortcutEvent> builtInShortcutEvenkey: 'Format highlight',command: 'meta+shift+h',windowsCommand: 'ctrl+shift+h',+ linuxCommand: 'ctrl+shift+h',handler: formatHighlightEventHandler,),+ ShortcutEvent(+ key: 'Format embed code',+ command: 'meta+e',+ windowsCommand: 'ctrl+e',++ linuxCommand: 'ctrl+e',+ handler: formatEmbedCodeEventHandler,+ ),ShortcutEvent(key: 'Format link',command: 'meta+k',diff --cc frontend/app_flowy/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dartindex 79b2f4d26c,0c85691504..034d91a93e--- a/frontend/app_flowy/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart+++ b/frontend/app_flowy/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart@@@ -81,8 -82,140 +82,142 @@@ void main() asynceditor.documentSelection,Selection.single(path: [1], startOffset: 0),);++ tester.pumpAndSettle();});++ testWidgets('redefine move cursor end command', (tester) async {+ const text = 'Welcome to Appflowy π';+ final editor = tester.editor+ ..insertTextNode(text)+ ..insertTextNode(text);+ await editor.startTesting();+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: 0),+ );+ if (Platform.isWindows || Platform.isLinux) {+ await editor.pressLogicKey(+ LogicalKeyboardKey.arrowRight,+ isControlPressed: true,+ );+ } else {+ await editor.pressLogicKey(+ LogicalKeyboardKey.arrowRight,+ isMetaPressed: true,+ );+ }+ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: text.length),+ );+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: 0),+ );++ for (final event in builtInShortcutEvents) {+ if (event.key == 'Move cursor end') {+ event.updateCommand(+ windowsCommand: 'alt+arrow right',+ linuxCommand: 'alt+arrow right',+ macOSCommand: 'alt+arrow right',+ );+ }+ }+ await editor.pressLogicKey(+ LogicalKeyboardKey.arrowRight,+ isAltPressed: true,+ );+ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: text.length),+ );+ });++ testWidgets('Test Home Key to move to start of current text',+ (tester) async {+ const text = 'Welcome to Appflowy π';+ final editor = tester.editor+ ..insertTextNode(text)+ ..insertTextNode(text);+ await editor.startTesting();+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: text.length),+ );+ if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {+ await editor.pressLogicKey(+ LogicalKeyboardKey.home,+ );+ }++ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: 0),+ );+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: text.length),+ );++ for (final event in builtInShortcutEvents) {+ if (event.key == 'Move cursor begin') {+ event.updateCommand(+ windowsCommand: 'home',+ linuxCommand: 'home',+ macOSCommand: 'home',+ );+ }+ }+ if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) {+ await editor.pressLogicKey(+ LogicalKeyboardKey.home,+ );+ }+ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: 0),+ );+ });++ testWidgets('Test End Key to move to end of current text', (tester) async {+ const text = 'Welcome to Appflowy π';+ final editor = tester.editor+ ..insertTextNode(text)+ ..insertTextNode(text);+ await editor.startTesting();+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: text.length),+ );+ if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {+ await editor.pressLogicKey(+ LogicalKeyboardKey.end,+ );+ }++ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: text.length),+ );+ await editor.updateSelection(+ Selection.single(path: [1], startOffset: 0),+ );++ for (final event in builtInShortcutEvents) {+ if (event.key == 'Move cursor end') {+ event.updateCommand(+ windowsCommand: 'end',+ linuxCommand: 'end',+ macOSCommand: 'end',+ );+ }+ }+ if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) {+ await editor.pressLogicKey(+ LogicalKeyboardKey.end,+ );+ }+ expect(+ editor.documentSelection,+ Selection.single(path: [1], startOffset: text.length),+ );+ });});}