File tree 2 files changed +15
-16
lines changed
core/instance/render-helpers
2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,6 @@ const keyCodes: { [key: string]: number | Array<number> } = {
16
16
'delete' : [ 8 , 46 ]
17
17
}
18
18
19
- const keyNames : { [ key : string ] : string | Array < string > } = {
20
- esc : 'Escape' ,
21
- tab : 'Tab' ,
22
- enter : 'Enter' ,
23
- space : ' ' ,
24
- up : 'ArrowUp' ,
25
- left : 'ArrowLeft' ,
26
- right : 'ArrowRight' ,
27
- down : 'ArrowDown' ,
28
- 'delete' : [ 'Backspace' , 'Delete' ]
29
- }
30
-
31
19
// #4868: modifiers that prevent the execution of the listener
32
20
// need to explicitly return null so that we can determine whether to remove
33
21
// the listener for .once
@@ -157,7 +145,6 @@ function genFilterCode (key: string): string {
157
145
` _k ( $event . keyCode , ` +
158
146
` $ { JSON . stringify ( key ) } , ` +
159
147
` $ { JSON . stringify ( code ) } , ` +
160
- ` $event . key , ` +
161
- ` $ { JSON . stringify ( keyNames [ key ] ) } ) `
148
+ ` $event . key ) `
162
149
)
163
150
}
Original file line number Diff line number Diff line change 3
3
import config from 'core/config'
4
4
import { hyphenate } from 'shared/util'
5
5
6
+ const keyNames : { [ key : string ] : string | Array < string > } = {
7
+ esc : 'Escape' ,
8
+ tab : 'Tab' ,
9
+ enter : 'Enter' ,
10
+ space : ' ' ,
11
+ up : 'ArrowUp' ,
12
+ left : 'ArrowLeft' ,
13
+ right : 'ArrowRight' ,
14
+ down : 'ArrowDown' ,
15
+ 'delete' : [ 'Backspace' , 'Delete' ]
16
+ }
17
+
6
18
function isKeyNotMatch < T > ( expect : T | Array < T > , actual : T ) : boolean {
7
19
if ( Array . isArray ( expect ) ) {
8
20
return expect . indexOf ( actual ) === - 1
@@ -20,10 +32,10 @@ export function checkKeyCodes (
20
32
eventKeyCode : number ,
21
33
key : string ,
22
34
builtInAlias ?: number | Array < number > ,
23
- eventKeyName ?: string ,
24
- builtInName ?: string | Array < string >
35
+ eventKeyName ?: string
25
36
) : ?boolean {
26
37
const keyCodes = config . keyCodes [ key ] || builtInAlias
38
+ const builtInName : string | Array < string > = keyNames [ key ]
27
39
if ( builtInName && keyCodes === builtInAlias && eventKeyName ) {
28
40
return isKeyNotMatch ( builtInName , eventKeyName )
29
41
} else if ( keyCodes ) {
You can’t perform that action at this time.
0 commit comments