diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart index b5f7afe885..816be7dc3a 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/internal_key_event_handlers/page_up_down_handler.dart @@ -2,21 +2,20 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:appflowy_editor/src/service/shortcut_event/shortcut_event_handler.dart'; -ShortcutEventHandler pageUpDownHandler = (editorState, event) { - if (event.logicalKey == LogicalKeyboardKey.pageUp) { - final scrollHeight = editorState.service.scrollService?.onePageHeight; - final scrollService = editorState.service.scrollService; - if (scrollHeight != null && scrollService != null) { - scrollService.scrollTo(scrollService.dy - scrollHeight); - } - return KeyEventResult.handled; - } else if (event.logicalKey == LogicalKeyboardKey.pageDown) { - final scrollHeight = editorState.service.scrollService?.onePageHeight; - final scrollService = editorState.service.scrollService; - if (scrollHeight != null && scrollService != null) { - scrollService.scrollTo(scrollService.dy + scrollHeight); - } - return KeyEventResult.handled; +ShortcutEventHandler pageUpHandler = (editorState, _) { + final scrollHeight = editorState.service.scrollService?.onePageHeight; + final scrollService = editorState.service.scrollService; + if (scrollHeight != null && scrollService != null) { + scrollService.scrollTo(scrollService.dy - scrollHeight); } - return KeyEventResult.ignored; + return KeyEventResult.handled; +}; + +ShortcutEventHandler pageDownHandler = (editorState, _) { + final scrollHeight = editorState.service.scrollService?.onePageHeight; + final scrollService = editorState.service.scrollService; + if (scrollHeight != null && scrollService != null) { + scrollService.scrollTo(scrollService.dy + scrollHeight); + } + return KeyEventResult.handled; }; diff --git 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 index e619246069..20b9d9722a 100644 --- 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 @@ -196,8 +196,13 @@ List builtInShortcutEvents = [ handler: selectAllHandler, ), ShortcutEvent( - key: 'page up / page down', - command: 'page up,page down', - handler: pageUpDownHandler, + key: 'Page up', + command: 'page up', + handler: pageUpHandler, + ), + ShortcutEvent( + key: 'Page down', + command: 'page down', + handler: pageDownHandler, ), ];