[pve-devel] [PATCH manager 2/4] ui: tags: shortcut accept&cancel with keypresses

Dominik Csapak d.csapak at proxmox.com
Fri Nov 18 12:59:16 CET 2022


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

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/Tag.js     | 3 ++-
 www/manager6/form/TagEdit.js | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/Tag.js b/www/manager6/form/Tag.js
index 8d003ca97..6fda2e848 100644
--- a/www/manager6/form/Tag.js
+++ b/www/manager6/form/Tag.js
@@ -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;
diff --git a/www/manager6/form/TagEdit.js b/www/manager6/form/TagEdit.js
index 23b75acc7..18d8927d7 100644
--- a/www/manager6/form/TagEdit.js
+++ b/www/manager6/form/TagEdit.js
@@ -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();
+			}
+		    },
 		},
 	    });
 
-- 
2.30.2






More information about the pve-devel mailing list