File tree 5 files changed +16
-5
lines changed
5 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ packages/*/lib
3
3
packages /* /node_modules
4
4
storybook-static
5
5
packages /docs /.docusaurus
6
- packages /docs /build
6
+ packages /docs /build
7
+ lerna.json
Original file line number Diff line number Diff line change 1
1
{
2
- "packages" : [
3
- " packages/*"
4
- ],
2
+ "packages" : [" packages/*" ],
5
3
"npmClient" : " yarn" ,
6
4
"useWorkspaces" : true ,
7
5
"version" : " 0.2.1"
Original file line number Diff line number Diff line change @@ -4,10 +4,16 @@ import { KeyboardBindings } from '../types';
4
4
import { defaultKeyboardBindings } from './defaultKeyboardBindings' ;
5
5
import { useTreeEnvironment } from '../controlledEnvironment/ControlledTreeEnvironment' ;
6
6
7
+ const elementsThatCanTakeText = [
8
+ 'input' ,
9
+ 'textarea'
10
+ ]
11
+
7
12
export const useHotkey = (
8
13
combinationName : keyof KeyboardBindings ,
9
14
onHit : ( e : KeyboardEvent ) => void ,
10
15
active ?: boolean ,
16
+ activatableWhileFocusingInput = false ,
11
17
deps ?: any [ ]
12
18
) => {
13
19
const environment = useTreeEnvironment ( ) ;
@@ -28,6 +34,11 @@ export const useHotkey = (
28
34
return ;
29
35
}
30
36
37
+ if ( ( elementsThatCanTakeText . includes ( ( e . target as HTMLElement ) . tagName . toLowerCase ( ) )
38
+ || ( e . target as HTMLElement ) . isContentEditable ) && ! activatableWhileFocusingInput ) {
39
+ return ;
40
+ }
41
+
31
42
if ( ! pressedKeys . current . includes ( e . key ) ) {
32
43
pressedKeys . current . push ( e . key ) ;
33
44
const pressedKeysLowercase = pressedKeys . current . map ( key => key . toLowerCase ( ) ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export const SearchInput: React.FC<{
38
38
} ) ;
39
39
} ,
40
40
isActiveTree && search !== null ,
41
+ true ,
41
42
[ search , isActiveTree ]
42
43
) ;
43
44
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const TreeItemRenamingInput: React.FC<{
40
40
41
41
useHotkey ( 'abortRenameItem' , ( ) => {
42
42
abort ( ) ;
43
- } ) ;
43
+ } , true , true ) ;
44
44
45
45
const inputProps : InputHTMLAttributes < HTMLInputElement > = {
46
46
value : title ,
You can’t perform that action at this time.
0 commit comments