Skip to content

Commit 83b53fa

Browse files
committed
Device-specific 'select all' key
1 parent 85e351a commit 83b53fa

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/text-annotator/src/SelectionHandler.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
debounce,
1111
splitAnnotatableRanges,
1212
rangeToSelector,
13+
isMac,
1314
isWhitespaceOrEmpty,
1415
trimRangeToContainer,
1516
NOT_ANNOTATABLE_SELECTOR
@@ -19,11 +20,11 @@ const CLICK_TIMEOUT = 300;
1920

2021
const ARROW_KEYS = ['up', 'down', 'left', 'right'];
2122

22-
const SELECT_ALL = ['ctrl+a', '⌘+a'];
23+
const SELECT_ALL = isMac ? '⌘+a' : 'ctrl+a';
2324

2425
const SELECTION_KEYS = [
2526
...ARROW_KEYS.map(key => `shift+${key}`),
26-
...SELECT_ALL
27+
SELECT_ALL
2728
];
2829

2930
export const SelectionHandler = (
@@ -271,7 +272,7 @@ export const SelectionHandler = (
271272
lastDownEvent = cloneKeyboardEvent(evt);
272273
});
273274

274-
hotkeys(SELECT_ALL.join(','), { keydown: true, keyup: false}, evt => {
275+
hotkeys(SELECT_ALL, { keydown: true, keyup: false}, evt => {
275276
lastDownEvent = cloneKeyboardEvent(evt);
276277
onSelectAll(evt);
277278
});

packages/text-annotator/src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from './cancelSingleClickEvents';
2+
export * from './device';
23
export * from './programmaticallyFocusable';
34
export * from './debounce';
45
export * from './getAnnotatableFragment';

0 commit comments

Comments
 (0)