Skip to content

Commit 92ad706

Browse files
committed
Allowing copy & paste functionality via keyboard for currency input component. Issue #1049
1 parent 5aea3c7 commit 92ad706

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

blazorbootstrap/wwwroot/blazor.bootstrap.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ window.blazorBootstrap = {
318318
return;
319319
}
320320

321+
// allow copy/paste keys, ctrl (Windows/Linux) or Cmd (macOS) key
322+
const isModifierPressed = event.ctrlKey || event.metaKey;
323+
const isCopyKeyPressed = event.key === 'c' || event.key === 'C';
324+
const isPasteKeyPressed = event.key === 'v' || event.key === 'V';
325+
if (isModifierPressed && (isCopyKeyPressed || isPasteKeyPressed)) {
326+
return;
327+
}
328+
321329
let validChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
322330

323331
if (isFloat) {

0 commit comments

Comments
 (0)