Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit 5f2dae9

Browse files
ETLaurentEtienne Laurent
andauthored
fix pasting on macos (#24)
* fix pasting on macos * changelog * fix pasting code with a leading 0 --------- Co-authored-by: Etienne Laurent <git.sabbath464@passmail.net>
1 parent ccbd77e commit 5f2dae9

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## UNRELEASED
4+
5+
* Fix pasting on MacOS.
6+
37
## 1.3.1 (2024-10-31)
48

59
* Adds AI-generated and community-reviewed missing translations

ui/apos/components/AposTotp.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)