Browse Source

chore: rename keyEventHandlers to shortcutEvents

Lucas.Xu 2 years ago
parent
commit
5d2160b0bb

+ 1 - 1
frontend/app_flowy/packages/appflowy_editor/example/lib/main.dart

@@ -96,7 +96,7 @@ class _MyHomePageState extends State<MyHomePage> {
             child: AppFlowyEditor(
             child: AppFlowyEditor(
               editorState: _editorState,
               editorState: _editorState,
               editorStyle: const EditorStyle.defaultStyle(),
               editorStyle: const EditorStyle.defaultStyle(),
-              keyEventHandlers: [
+              shortcutEvents: [
                 underscoreToItalicEvent,
                 underscoreToItalicEvent,
               ],
               ],
             ),
             ),

+ 3 - 3
frontend/app_flowy/packages/appflowy_editor/lib/src/service/editor_service.dart

@@ -36,7 +36,7 @@ class AppFlowyEditor extends StatefulWidget {
     Key? key,
     Key? key,
     required this.editorState,
     required this.editorState,
     this.customBuilders = const {},
     this.customBuilders = const {},
-    this.keyEventHandlers = const [],
+    this.shortcutEvents = const [],
     this.selectionMenuItems = const [],
     this.selectionMenuItems = const [],
     this.editorStyle = const EditorStyle.defaultStyle(),
     this.editorStyle = const EditorStyle.defaultStyle(),
   }) : super(key: key);
   }) : super(key: key);
@@ -47,7 +47,7 @@ class AppFlowyEditor extends StatefulWidget {
   final NodeWidgetBuilders customBuilders;
   final NodeWidgetBuilders customBuilders;
 
 
   /// Keyboard event handlers.
   /// Keyboard event handlers.
-  final List<ShortcutEvent> keyEventHandlers;
+  final List<ShortcutEvent> shortcutEvents;
 
 
   final List<SelectionMenuItem> selectionMenuItems;
   final List<SelectionMenuItem> selectionMenuItems;
 
 
@@ -96,7 +96,7 @@ class _AppFlowyEditorState extends State<AppFlowyEditor> {
               key: editorState.service.keyboardServiceKey,
               key: editorState.service.keyboardServiceKey,
               shortcutEvents: [
               shortcutEvents: [
                 ...builtInShortcutEvents,
                 ...builtInShortcutEvents,
-                ...widget.keyEventHandlers,
+                ...widget.shortcutEvents,
               ],
               ],
               editorState: editorState,
               editorState: editorState,
               child: FlowyToolbar(
               child: FlowyToolbar(