Forráskód Böngészése

Added ability to overwrite keyboard shortcuts in frontend config

Owen Diffey 3 éve
szülő
commit
28a70d2cb7

+ 10 - 1
frontend/dist/config/template.json

@@ -22,6 +22,15 @@
 	"messages": {
 		"accountRemoval": "Your account will be deactivated instantly and your data will shortly be deleted by an admin."
 	},
+	"shortcutOverrides": {
+		"editSong.useAllDiscogs": {
+			"keyCode": 68,
+			"ctrl": true,
+			"alt": true,
+			"shift": false,
+			"preventDefault": true
+		}
+	},
 	"skipConfigVersionCheck": false,
-	"configVersion": 6
+	"configVersion": 7
 }

+ 7 - 0
frontend/src/keyboardShortcuts.js

@@ -32,6 +32,13 @@ const lib = {
 		shortcuts[name].shift = shortcuts[name].shift
 			? shortcuts[name].shift
 			: false;
+		lofig.get("shortcutOverrides").then(overrides => {
+			if (overrides && overrides[name])
+				shortcuts[name] = Object.assign(
+					shortcuts[name],
+					overrides[name]
+				);
+		});
 		lib.remakeShortcutsArray();
 	},
 

+ 1 - 1
frontend/src/main.js

@@ -9,7 +9,7 @@ import store from "./store";
 
 import AppComponent from "./App.vue";
 
-const REQUIRED_CONFIG_VERSION = 6;
+const REQUIRED_CONFIG_VERSION = 7;
 
 const handleMetadata = attrs => {
 	document.title = `Musare | ${attrs.title}`;