Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions webapp/packages/core-view/src/View/CaptureView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 DBeaver Corp and others
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
import styles from './CaptureView.module.css';
import { CaptureViewContext } from './CaptureViewContext.js';
import type { IView } from './IView.js';
import { parseHotkey } from './parseHotkey.js';
import { mapShortcut, parseHotkey } from './parseHotkey.js';
import { useActiveView } from './useActiveView.js';
import { useViewContext } from './useViewContext.js';

Expand All @@ -40,7 +40,10 @@
.filter(action => action?.binding && !action.isDisabled())
.filter(Boolean) as IActionItem[];

const keys = actionItems.map(item => getCommonAndOSSpecificKeys(item.binding?.binding)).flat();
const keys = actionItems
.map(item => getCommonAndOSSpecificKeys(item.binding?.binding))
.flat()
.map(item => mapShortcut(item));

useHotkeys(
keys,
Expand All @@ -58,6 +61,8 @@
});
});

console.log(action);

Check warning on line 64 in webapp/packages/core-view/src/View/CaptureView.tsx

View workflow job for this annotation

GitHub Actions / Frontend / Lint

Unexpected console statement. Only these console methods are allowed: warn, error

action?.activate(true);
},
{
Expand Down
6 changes: 5 additions & 1 deletion webapp/packages/core-view/src/View/parseHotkey.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 DBeaver Corp and others
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,6 +39,10 @@ export function mapKey(key: string): string {
.replace(/key|digit|numpad|arrow/, '');
}

export function mapShortcut(shortcut: string, combinationKey = '+'): string {
return shortcut.split(combinationKey).map(mapKey).join(combinationKey);
}

export function isHotkeyModifier(key: string): boolean {
return reservedModifierKeywords.includes(key);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 DBeaver Corp and others
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,5 +34,5 @@ export const KEY_BINDING_SAVE: IKeyBinding = {

export const KEY_BINDING_CANCEL: IKeyBinding = {
id: 'data-viewer-cancel',
keys: ['Alt+Escape'],
keys: ['mod+.'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mod+period?

};
Loading