Saving the hotkeys definitions
This commit is contained in:
parent
20f274962b
commit
a77838d550
@ -22,7 +22,7 @@ export class HotkeysContext {
|
||||
|
||||
register(command, hotkey) {
|
||||
if (!hotkey) {
|
||||
return OHIF.log.warn(`No hotkey was defined for "${command}"`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!command) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
<template name="hotkeysForm">
|
||||
{{#form (extend this class='form-themed')}}
|
||||
{{#form (extend this class='form-themed' api=instance.api)}}
|
||||
{{#each hotkeyInputInformation in getHotkeyInputInformationList}}
|
||||
{{>inputText (extend hotkeyInputInformation class='hotkey')}}
|
||||
{{/each}}
|
||||
<hr>
|
||||
{{#button class='btn btn-primary' action='save'}}Save{{/button}}
|
||||
{{/form}}
|
||||
</template>
|
||||
|
||||
@ -7,6 +7,15 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
Template.hotkeysForm.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.api = {
|
||||
save() {
|
||||
const { contextName } = instance.data;
|
||||
const form = instance.$('form').first().data('component');
|
||||
const definitions = form.value();
|
||||
OHIF.hotkeys.store(contextName, definitions);
|
||||
}
|
||||
};
|
||||
|
||||
const rg = (start, end) => _.range(start, end + 1);
|
||||
instance.allowedKeys = _.union(rg(32, 40), rg(48, 57), rg(65, 90), rg(112, 121), [123]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user