Skip to content

Commit 6dea594

Browse files
committed
pikvm/pikvm#1500: web: Paste hotkey
1 parent fd5196a commit 6dea594

File tree

6 files changed

+22
-43
lines changed

6 files changed

+22
-43
lines changed

web/kvm/index.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<link rel="stylesheet" href="../share/css/keypad.css">
4747
<link rel="stylesheet" href="../share/css/tabs.css">
4848
<link rel="stylesheet" href="../share/css/kvm/stream.css">
49-
<link rel="stylesheet" href="../share/css/kvm/hid.css">
5049
<link rel="stylesheet" href="../share/css/kvm/msd.css">
5150
<link rel="stylesheet" href="../share/css/kvm/system.css">
5251
<link rel="stylesheet" href="../share/css/kvm/keyboard.css">
@@ -763,15 +762,15 @@
763762
</tr>
764763
</table>
765764
<hr>
766-
<input id="hid-recorder-new-script-file" type="file">
765+
<input id="hid-recorder-new-script-file" type="file" style="display: none">
767766
<div class="buttons buttons-row">
768767
<button class="row50" id="hid-recorder-upload" disabled>Upload script</button>
769768
<button class="row50" id="hid-recorder-download" disabled>Download script</button>
770769
</div>
771770
</div>
772771
</li>
773772
<li class="right" id="text-dropdown"><a class="menu-button" href="#"><img class="feature-disabled" id="stream-ocr-led" src="../share/svg/led-gear.svg"><span>Text</span></a>
774-
<div class="menu" id="text-menu">
773+
<div class="menu" id="text-menu" style="width: 360px">
775774
<div class="text"><b>Paste text as keypress sequence<br></b><sub>Please note that PiKVM cannot switch the keyboard layout</sub></div>
776775
<hr>
777776
<div class="text" style="margin-right: 20px">
@@ -780,9 +779,9 @@
780779
<table class="kv">
781780
<tr>
782781
<td>
783-
<button id="hid-pak-button" disabled data-force-hide-menu>&bull; Paste</button>
782+
<button id="hid-pak-button" disabled data-force-hide-menu title="Ctrl+Enter when the text is focused">&bull; Paste</button>
784783
</td>
785-
<td>using host keymap</td>
784+
<td>using a host keymap</td>
786785
<td>
787786
<select id="hid-pak-keymap-selector"></select>
788787
</td>
@@ -839,10 +838,10 @@
839838
</table>
840839
<table class="kv">
841840
<tr>
842-
<td colspan="4">&bull; Press <b>Enter</b> to recognize and copy text to clipboard</td>
841+
<td colspan="4">&bull; Next hit the <b>Enter</b> to recognize and copy text to clipboard...</td>
843842
</tr>
844843
<tr>
845-
<td colspan="4">&bull; Press <b>Esc</b> to cancel selection</td>
844+
<td colspan="4">&bull; Or hit the <b>Escape</b> to cancel a selection</td>
846845
</tr>
847846
<tr>
848847
<td></td>

web/kvm/index.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ append vars
1010
css_list.push(
1111
"navbar", "window", "modal", "led", "slider",
1212
"switch", "radio", "progress", "keypad", "tabs",
13-
"kvm/stream", "kvm/hid", "kvm/msd",
13+
"kvm/stream", "kvm/msd",
1414
"kvm/system", "kvm/keyboard", "kvm/about"
1515
)
1616

web/kvm/navbar-macro.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ li.right#macro-dropdown
2929
+menu_switch_table("hid-recorder-loop-switch", false, false) Infinite loop playback:
3030
hr
3131

32-
input#hid-recorder-new-script-file(type="file")
32+
input#hid-recorder-new-script-file(type="file" style="display: none")
3333

3434
.buttons.buttons-row
3535
button.row50#hid-recorder-upload(disabled) Upload script

web/kvm/navbar-text.pug

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ li.right#text-dropdown
33
+navbar_led("stream-ocr-led", "led-gear", "feature-disabled")
44
span Text
55

6-
.menu#text-menu
6+
.menu#text-menu(style="width: 360px")
77
.text
88
b Paste text as keypress sequence#[br]
99
sub Please note that PiKVM cannot switch the keyboard layout
@@ -12,8 +12,8 @@ li.right#text-dropdown
1212
textarea#hid-pak-text(data-focus placeholder="Enter your text here")
1313
table.kv
1414
tr
15-
td #[button#hid-pak-button(disabled data-force-hide-menu) &bull; Paste]
16-
td using host keymap
15+
td #[button#hid-pak-button(disabled data-force-hide-menu title="Ctrl+Enter when the text is focused") &bull; Paste]
16+
td using a host keymap
1717
td #[select#hid-pak-keymap-selector]
1818
table.kv
1919
tr
@@ -39,8 +39,8 @@ li.right#text-dropdown
3939
td text recognition
4040
table.kv
4141
tr
42-
td(colspan="4") &bull; Press #[b Enter] to recognize and copy text to clipboard
42+
td(colspan="4") &bull; Next hit the #[b Enter] to recognize and copy text to clipboard...
4343
tr
44-
td(colspan="4") &bull; Press #[b Esc] to cancel selection
44+
td(colspan="4") &bull; Or hit the #[b Escape] to cancel a selection
4545
tr
4646
td

web/share/css/kvm/hid.css

Lines changed: 0 additions & 29 deletions
This file was deleted.

web/share/js/kvm/paste.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@ export function Paste(__recorder) {
3333
/************************************************************************/
3434

3535
var __init__ = function() {
36+
$("hid-pak-text").addEventListener("keyup", function(event) {
37+
if (event.ctrlKey && event.code == "Enter") {
38+
$("hid-pak-button").click();
39+
}
40+
});
41+
3642
tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", true);
3743
tools.storage.bindSimpleSwitch($("hid-pak-slow-switch"), "hid.pak.slow", false);
44+
3845
tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", false, function(value) {
3946
$("hid-pak-text").style.setProperty("-webkit-text-security", (value ? "disc" : "none"));
4047
});
48+
4149
$("hid-pak-keymap-selector").addEventListener("change", function() {
4250
tools.storage.set("hid.pak.keymap", $("hid-pak-keymap-selector").value);
4351
});
52+
4453
tools.el.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton);
4554
};
4655

0 commit comments

Comments
 (0)