mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: undo redo handler
This commit is contained in:
parent
b9de45a110
commit
7c58654fe8
@ -17,6 +17,7 @@ import 'package:flowy_editor/service/internal_key_event_handlers/enter_without_s
|
||||
import 'package:flowy_editor/service/internal_key_event_handlers/slash_handler.dart';
|
||||
import 'package:flowy_editor/service/internal_key_event_handlers/update_text_style_by_command_x_handler.dart';
|
||||
import 'package:flowy_editor/service/internal_key_event_handlers/whitespace_handler.dart';
|
||||
import 'package:flowy_editor/service/internal_key_event_handlers/redo_undo_handler.dart';
|
||||
import 'package:flowy_editor/service/keyboard_service.dart';
|
||||
import 'package:flowy_editor/service/render_plugin_service.dart';
|
||||
import 'package:flowy_editor/service/scroll_service.dart';
|
||||
@ -39,6 +40,7 @@ List<FlowyKeyEventHandler> defaultKeyEventHandler = [
|
||||
flowyDeleteNodesHandler,
|
||||
arrowKeysHandler,
|
||||
copyPasteKeysHandler,
|
||||
redoUndoKeysHandler,
|
||||
enterWithoutShiftInTextNodesHandler,
|
||||
updateTextStyleByCommandXHandler,
|
||||
whiteSpaceHandler,
|
||||
|
@ -0,0 +1,15 @@
|
||||
import 'package:flowy_editor/service/keyboard_service.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
FlowyKeyEventHandler redoUndoKeysHandler = (editorState, event) {
|
||||
if (event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyZ) {
|
||||
if (event.isShiftPressed) {
|
||||
editorState.undoManager.redo();
|
||||
} else {
|
||||
editorState.undoManager.undo();
|
||||
}
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
};
|
Loading…
Reference in New Issue
Block a user