mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
Implement ctrl-shift click to select multiple documents (#1851)
* Initial implementation of shift and ctrl click to select * Implement shift-ctrl selection * Fix snapshot, update selectionHelper comment * Fix missing type * Properly disable cursor selection * Update snapshots * Do not enable (multiselect) if readonly * Consider meta key for mac and ctrl for everything else
This commit is contained in:
15
src/Utils/KeyboardUtils.ts
Normal file
15
src/Utils/KeyboardUtils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Is the environment 'ctrl' key press. This key is used for multi selection, like select one more item, select all.
|
||||
* For Windows and Linux, it's ctrl. For Mac, it's command.
|
||||
*/
|
||||
export const isEnvironmentCtrlPressed = (event: JQueryEventObject | React.MouseEvent): boolean =>
|
||||
isMac() ? event.metaKey : event.ctrlKey;
|
||||
|
||||
export const isEnvironmentShiftPressed = (event: JQueryEventObject | React.MouseEvent): boolean => event.shiftKey;
|
||||
|
||||
export const isEnvironmentAltPressed = (event: JQueryEventObject | React.MouseEvent): boolean => event.altKey;
|
||||
|
||||
/**
|
||||
* Returns whether the current platform is MacOS.
|
||||
*/
|
||||
export const isMac = (): boolean => navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|
||||
Reference in New Issue
Block a user