aboutsummaryrefslogtreecommitdiff
path: root/ext/js/data
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-27 22:30:45 -0400
committerGitHub <noreply@github.com>2021-03-27 22:30:45 -0400
commit2098d2faaeb1658ef753eb9f4ac123698938480e (patch)
tree72a92c3c9a2f3de4c6e5419d4e4bda55d5d04c6a /ext/js/data
parentaf04a4f414ae0a2dce6c46dc30c9fdee119912c2 (diff)
Hotkey arguments (#1565)
* Update display * Move scope definitions * Update scopes button after changing action * Don't show menu if empty * Improve scope updating * Update style * Simplify * Add argument to settings * Update convertToNumber implementation * Add support for arguments * Pass argument to action handler * Update hotkey action definitions * Remove x3 options
Diffstat (limited to 'ext/js/data')
-rw-r--r--ext/js/data/options-util.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index fd62a558..5b2e2bd3 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -754,8 +754,32 @@ class OptionsUtil {
// Version 10 changes:
// Removed global option useSettingsV2.
// Added part-of-speech field template.
+ // Added an argument to hotkey inputs.
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v10.handlebars');
delete options.global.useSettingsV2;
+ for (const profile of options.profiles) {
+ for (const hotkey of profile.options.inputs.hotkeys) {
+ switch (hotkey.action) {
+ case 'previousEntry':
+ hotkey.argument = '1';
+ break;
+ case 'previousEntry3':
+ hotkey.action = 'previousEntry';
+ hotkey.argument = '3';
+ break;
+ case 'nextEntry':
+ hotkey.argument = '1';
+ break;
+ case 'nextEntry3':
+ hotkey.action = 'nextEntry';
+ hotkey.argument = '3';
+ break;
+ default:
+ hotkey.argument = '';
+ break;
+ }
+ }
+ }
return options;
}
}