@@ -145,7 +145,7 @@ export default {
145145 code: Array (6 ).fill (' ' ),
146146 copying: false ,
147147 busy: false ,
148- controlPressed : false ,
148+ controlOrMetaKeyPressed : false ,
149149 errorMsg: ' '
150150 };
151151 },
@@ -211,16 +211,15 @@ export default {
211211 }
212212 },
213213 handleKeyDown (e , i ) {
214- const keysWithDefaultBehavior = [ ' Shit' , ' Tab' ];
215214 const digit = this .code [i];
216215 const isNumber = ! isNaN (parseInt (e .key , 10 ));
217- const isPasting = e .key === ' v' && this . controlPressed ;
216+ const isPasting = this . controlOrMetaKeyPressed && e .key === ' v' ;
218217
219- if (e . key === ' Control' ) {
220- this .controlPressed = true ;
218+ if ([ ' Control' , ' Meta ' ]. includes ( e . key ) ) {
219+ this .controlOrMetaKeyPressed = true ;
221220 }
222221
223- if (! keysWithDefaultBehavior . includes ( e .key ) && ! isPasting) {
222+ if (e .key !== ' Tab ' && ! isPasting) {
224223 e .preventDefault ();
225224 }
226225
@@ -248,8 +247,8 @@ export default {
248247 },
249248
250249 handleKeyUp (e ) {
251- if (e . key === ' Control' ) {
252- this .controlPressed = false ;
250+ if ([ ' Control' , ' Meta ' ]. includes ( e . key ) ) {
251+ this .controlOrMetaKeyPressed = false ;
253252 }
254253 },
255254
@@ -291,7 +290,7 @@ export default {
291290 return ;
292291 }
293292
294- codeNumber . toString () .split (' ' ).forEach ((num , i ) => {
293+ code .split (' ' ).forEach ((num , i ) => {
295294 this .code .splice (i, 1 , num);
296295 });
297296 },
0 commit comments