mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: accept multi-key combination for customizing shortcuts & removes duplicates (#5414)
This commit is contained in:
@ -56,7 +56,18 @@ final List<CommandShortcutEvent> commandShortcutEvents = [
|
||||
customPasteCommand,
|
||||
customCutCommand,
|
||||
...customTextAlignCommands,
|
||||
...standardCommandShortcutEvents,
|
||||
|
||||
// remove standard shortcuts for copy, cut, paste, todo
|
||||
...standardCommandShortcutEvents
|
||||
..removeWhere(
|
||||
(shortcut) => [
|
||||
copyCommand,
|
||||
cutCommand,
|
||||
pasteCommand,
|
||||
toggleTodoListCommand,
|
||||
].contains(shortcut),
|
||||
),
|
||||
|
||||
emojiShortcutEvent,
|
||||
];
|
||||
|
||||
@ -90,7 +101,6 @@ class AppFlowyEditorPage extends StatefulWidget {
|
||||
final String Function(Node)? placeholderText;
|
||||
|
||||
/// Used to provide an initial selection on Page-load
|
||||
///
|
||||
final Selection? initialSelection;
|
||||
|
||||
final bool useViewInfoBloc;
|
||||
@ -111,15 +121,8 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
],
|
||||
);
|
||||
|
||||
late final List<CommandShortcutEvent> commandShortcutEvents = [
|
||||
toggleToggleListCommand,
|
||||
...localizedCodeBlockCommands,
|
||||
customCopyCommand,
|
||||
customPasteCommand,
|
||||
customCutCommand,
|
||||
...customTextAlignCommands,
|
||||
...standardCommandShortcutEvents,
|
||||
emojiShortcutEvent,
|
||||
late final List<CommandShortcutEvent> cmdShortcutEvents = [
|
||||
...commandShortcutEvents,
|
||||
..._buildFindAndReplaceCommands(),
|
||||
];
|
||||
|
||||
@ -309,7 +312,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
),
|
||||
// customize the shortcuts
|
||||
characterShortcutEvents: characterShortcutEvents,
|
||||
commandShortcutEvents: commandShortcutEvents,
|
||||
commandShortcutEvents: cmdShortcutEvents,
|
||||
// customize the context menu items
|
||||
contextMenuItems: customContextMenuItems,
|
||||
// customize the header and footer.
|
||||
@ -401,7 +404,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
final customizeShortcuts =
|
||||
await settingsShortcutService.getCustomizeShortcuts();
|
||||
await settingsShortcutService.updateCommandShortcuts(
|
||||
commandShortcutEvents,
|
||||
cmdShortcutEvents,
|
||||
customizeShortcuts,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user