Skip to content

Commit

Permalink
fix: KeyBindingMap
Browse files Browse the repository at this point in the history
  • Loading branch information
dineug committed Jan 26, 2024
1 parent fe8d382 commit 9a992c6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/erd-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dineug/erd-editor",
"version": "3.1.4",
"version": "3.1.5",
"description": "Entity-Relationship Diagram Editor",
"type": "module",
"main": "./dist/erd-editor.js",
Expand Down
54 changes: 37 additions & 17 deletions packages/erd-editor/src/utils/keyboard-shortcut/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,49 @@ export const createKeyBindingMap = (): KeyBindingMap => ({
[KeyBindingName.search]: [
{ shortcut: '$mod+KeyK', preventDefault: true, stopPropagation: true },
],
[KeyBindingName.undo]: [{ shortcut: '$mod+KeyZ', preventDefault: true }],
[KeyBindingName.undo]: [
{ shortcut: '$mod+KeyZ', preventDefault: true, stopPropagation: true },
],
[KeyBindingName.redo]: [
{ shortcut: '$mod+Shift+KeyZ', preventDefault: true },
{
shortcut: '$mod+Shift+KeyZ',
preventDefault: true,
stopPropagation: true,
},
],
[KeyBindingName.addTable]: [{ shortcut: 'Alt+KeyN' }],
[KeyBindingName.addColumn]: [{ shortcut: 'Alt+Enter' }],
[KeyBindingName.addMemo]: [{ shortcut: 'Alt+KeyM' }],
[KeyBindingName.addTable]: [{ shortcut: 'Alt+KeyN', preventDefault: true }],
[KeyBindingName.addColumn]: [{ shortcut: 'Alt+Enter', preventDefault: true }],
[KeyBindingName.addMemo]: [{ shortcut: 'Alt+KeyM', preventDefault: true }],
[KeyBindingName.removeTable]: [
{ shortcut: '$mod+Backspace' },
{ shortcut: '$mod+Delete' },
{ shortcut: '$mod+Backspace', preventDefault: true },
{ shortcut: '$mod+Delete', preventDefault: true },
],
[KeyBindingName.removeColumn]: [
{ shortcut: 'Alt+Backspace' },
{ shortcut: 'Alt+Delete' },
{ shortcut: 'Alt+Backspace', preventDefault: true },
{ shortcut: 'Alt+Delete', preventDefault: true },
],
[KeyBindingName.primaryKey]: [{ shortcut: 'Alt+KeyK', preventDefault: true }],
[KeyBindingName.selectAllTable]: [
{ shortcut: '$mod+Alt+KeyA', preventDefault: true },
],
[KeyBindingName.selectAllColumn]: [
{ shortcut: 'Alt+KeyA', preventDefault: true },
],
[KeyBindingName.relationshipZeroOne]: [
{ shortcut: '$mod+Alt+Digit1', preventDefault: true },
],
[KeyBindingName.relationshipZeroN]: [
{ shortcut: '$mod+Alt+Digit2', preventDefault: true },
],
[KeyBindingName.relationshipOneOnly]: [
{ shortcut: '$mod+Alt+Digit3', preventDefault: true },
],
[KeyBindingName.relationshipOneN]: [
{ shortcut: '$mod+Alt+Digit4', preventDefault: true },
],
[KeyBindingName.tableProperties]: [
{ shortcut: 'Alt+Space', preventDefault: true },
],
[KeyBindingName.primaryKey]: [{ shortcut: 'Alt+KeyK' }],
[KeyBindingName.selectAllTable]: [{ shortcut: '$mod+Alt+KeyA' }],
[KeyBindingName.selectAllColumn]: [{ shortcut: 'Alt+KeyA' }],
[KeyBindingName.relationshipZeroOne]: [{ shortcut: '$mod+Alt+Digit1' }],
[KeyBindingName.relationshipZeroN]: [{ shortcut: '$mod+Alt+Digit2' }],
[KeyBindingName.relationshipOneOnly]: [{ shortcut: '$mod+Alt+Digit3' }],
[KeyBindingName.relationshipOneN]: [{ shortcut: '$mod+Alt+Digit4' }],
[KeyBindingName.tableProperties]: [{ shortcut: 'Alt+Space' }],
[KeyBindingName.zoomIn]: [
{ shortcut: '$mod+Equal', preventDefault: true, stopPropagation: true },
],
Expand Down

0 comments on commit 9a992c6

Please sign in to comment.