diff options
author | Maxim Devaev <[email protected]> | 2024-10-02 01:05:55 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-10-02 02:45:59 +0300 |
commit | 4e1d9815cdf79f8bc5ad1d9c9f4057136fd6238e (patch) | |
tree | 4c7dc161d59c20b8ffacb311db19d6535907097e /web/share/js/kvm/recorder.js | |
parent | 8209ee2eb0bd411c74d7d7dbf7b1b79e46dd79c0 (diff) |
pikvm/pikvm#1407: Save keymap on macro recording
Diffstat (limited to 'web/share/js/kvm/recorder.js')
-rw-r--r-- | web/share/js/kvm/recorder.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/web/share/js/kvm/recorder.js b/web/share/js/kvm/recorder.js index f32b5a2e..822aa972 100644 --- a/web/share/js/kvm/recorder.js +++ b/web/share/js/kvm/recorder.js @@ -67,8 +67,8 @@ export function Recorder() { __recordEvent(event); }; - self.recordPrintEvent = function(text) { - __recordEvent({"event_type": "print", "event": {"text": text}}); + self.recordPrintEvent = function(text, keymap) { + __recordEvent({"event_type": "print", "event": {"text": text, "keymap": keymap}}); }; self.recordAtxButtonEvent = function(button) { @@ -159,6 +159,9 @@ export function Recorder() { } else if (event.event_type === "print") { __checkType(event.event.text, "string", "Non-string print text"); + if (event.event.keymap) { + __checkType(event.event.keymap, "string", "Non-string keymap"); + } } else if (event.event_type === "key") { __checkType(event.event.key, "string", "Non-string key code"); @@ -280,7 +283,11 @@ export function Recorder() { return; } else if (event.event_type === "print") { - tools.httpPost("/api/hid/print", {"limit": 0}, function(http) { + let params = {"limit": 0}; + if (event.event.keymap) { + params["keymap"] = event.event.keymap; + } + tools.httpPost("/api/hid/print", params, function(http) { if (http.status === 413) { wm.error("Too many text for paste!"); __stopProcess(); |