ui: tags: shortcut accept&cancel with keypresses

pressing 'Enter' accepts the current tags and
'Escape' cancels editing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-11-18 12:59:16 +01:00 committed by Thomas Lamprecht
parent 1b48b8b7a1
commit e83ea30e4a
2 changed files with 9 additions and 1 deletions

View File

@ -104,10 +104,11 @@ Ext.define('Proxmox.form.Tag', {
let key = event.browserEvent.key;
switch (key) {
case 'Enter':
case 'Escape':
me.fireEvent('keypress', key);
break;
case 'ArrowLeft':
case 'ArrowRight':
case 'Escape':
case 'Backspace':
case 'Delete':
return;

View File

@ -214,6 +214,13 @@ Ext.define('PVE.panel.TagEditContainer', {
destroy: function() {
vm.set('tagCount', vm.get('tagCount') - 1);
},
keypress: function(key) {
if (key === 'Enter') {
me.editClick();
} else if (key === 'Escape') {
me.cancelClick();
}
},
},
});