From 0881cff68a27c67ff64781b92b551a36cf3e5f56 Mon Sep 17 00:00:00 2001 From: James Lucas Date: Fri, 13 Oct 2023 11:38:26 +1100 Subject: [PATCH] fix: use non-deprecated keyboardEvent.code instead of keyboardEvent.keycode. --- src/js/form-builder.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/js/form-builder.js b/src/js/form-builder.js index 26c1fe388..90229fca0 100644 --- a/src/js/form-builder.js +++ b/src/js/form-builder.js @@ -2037,21 +2037,38 @@ function FormBuilder(opts, element, $) { if (e.keyCode == 87 || e.keyCode == 38) { moveFieldUp(rowWrapper) } + switch (event.code) { + case 'KeyW': + case 'ArrowUp': + moveFieldUp(rowWrapper) + break if (e.keyCode == 83 || e.keyCode == 40) { moveFieldDown(rowWrapper) } + case 'KeyS': + case 'ArrowDown': + moveFieldDown(rowWrapper) + break if (e.keyCode == 65 || e.keyCode == 37) { moveFieldLeft() } + case 'KeyA': + case 'ArrowLeft': + moveFieldLeft() + break if (e.keyCode == 68 || e.keyCode == 39) { moveFieldRight() - } - - if (e.keyCode == 82) { - autoSizeRowColumns(rowWrapper, true) + case 'KeyD': + case 'ArrowRight': + moveFieldRight() + break + + case 'KeyR': + autoSizeRowColumns(rowWrapper, true) + break } buildGridModeCurrentRowInfo()