Selaa lähdekoodia

IE11 / Edge keyboard compatibility (#2507)

https://github.com/FreshRSS/FreshRSS/pull/2506#issuecomment-523544684
Alexandre Alapetite 6 vuotta sitten
vanhempi
commit
125a83efc9
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8 2
      p/scripts/main.js

+ 8 - 2
p/scripts/main.js

@@ -720,8 +720,14 @@ function init_shortcuts() {
 				return true;
 			}
 
-			const s = context.shortcuts,
-				k = (ev.key.trim() || ev.code).toUpperCase();
+			const s = context.shortcuts;
+			let k = (ev.key.trim() || ev.code || 'Space').toUpperCase();
+
+			//IE11
+			if (k === 'SPACEBAR') k = 'SPACE';
+			else if (k === 'DEL') k = 'DELETE';
+			else if (k === 'ESC') k = 'ESCAPE';
+
 			if (location.hash.match(/^#dropdown-/)) {
 				const n = parseInt(k);
 				if (n) {