This commit is contained in:
Maxim Devaev 2025-05-03 05:03:48 +03:00
parent fd5196a2ce
commit 6dea594380
6 changed files with 22 additions and 43 deletions

View File

@ -46,7 +46,6 @@
<link rel="stylesheet" href="../share/css/keypad.css"> <link rel="stylesheet" href="../share/css/keypad.css">
<link rel="stylesheet" href="../share/css/tabs.css"> <link rel="stylesheet" href="../share/css/tabs.css">
<link rel="stylesheet" href="../share/css/kvm/stream.css"> <link rel="stylesheet" href="../share/css/kvm/stream.css">
<link rel="stylesheet" href="../share/css/kvm/hid.css">
<link rel="stylesheet" href="../share/css/kvm/msd.css"> <link rel="stylesheet" href="../share/css/kvm/msd.css">
<link rel="stylesheet" href="../share/css/kvm/system.css"> <link rel="stylesheet" href="../share/css/kvm/system.css">
<link rel="stylesheet" href="../share/css/kvm/keyboard.css"> <link rel="stylesheet" href="../share/css/kvm/keyboard.css">
@ -763,7 +762,7 @@
</tr> </tr>
</table> </table>
<hr> <hr>
<input id="hid-recorder-new-script-file" type="file"> <input id="hid-recorder-new-script-file" type="file" style="display: none">
<div class="buttons buttons-row"> <div class="buttons buttons-row">
<button class="row50" id="hid-recorder-upload" disabled>Upload script</button> <button class="row50" id="hid-recorder-upload" disabled>Upload script</button>
<button class="row50" id="hid-recorder-download" disabled>Download script</button> <button class="row50" id="hid-recorder-download" disabled>Download script</button>
@ -771,7 +770,7 @@
</div> </div>
</li> </li>
<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> <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>
<div class="menu" id="text-menu"> <div class="menu" id="text-menu" style="width: 360px">
<div class="text"><b>Paste text as keypress sequence<br></b><sub>Please note that PiKVM cannot switch the keyboard layout</sub></div> <div class="text"><b>Paste text as keypress sequence<br></b><sub>Please note that PiKVM cannot switch the keyboard layout</sub></div>
<hr> <hr>
<div class="text" style="margin-right: 20px"> <div class="text" style="margin-right: 20px">
@ -780,9 +779,9 @@
<table class="kv"> <table class="kv">
<tr> <tr>
<td> <td>
<button id="hid-pak-button" disabled data-force-hide-menu>&bull; Paste</button> <button id="hid-pak-button" disabled data-force-hide-menu title="Ctrl+Enter when the text is focused">&bull; Paste</button>
</td> </td>
<td>using host keymap</td> <td>using a host keymap</td>
<td> <td>
<select id="hid-pak-keymap-selector"></select> <select id="hid-pak-keymap-selector"></select>
</td> </td>
@ -839,10 +838,10 @@
</table> </table>
<table class="kv"> <table class="kv">
<tr> <tr>
<td colspan="4">&bull; Press <b>Enter</b> to recognize and copy text to clipboard</td> <td colspan="4">&bull; Next hit the <b>Enter</b> to recognize and copy text to clipboard...</td>
</tr> </tr>
<tr> <tr>
<td colspan="4">&bull; Press <b>Esc</b> to cancel selection</td> <td colspan="4">&bull; Or hit the <b>Escape</b> to cancel a selection</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>

View File

@ -10,7 +10,7 @@ append vars
css_list.push( css_list.push(
"navbar", "window", "modal", "led", "slider", "navbar", "window", "modal", "led", "slider",
"switch", "radio", "progress", "keypad", "tabs", "switch", "radio", "progress", "keypad", "tabs",
"kvm/stream", "kvm/hid", "kvm/msd", "kvm/stream", "kvm/msd",
"kvm/system", "kvm/keyboard", "kvm/about" "kvm/system", "kvm/keyboard", "kvm/about"
) )

View File

@ -29,7 +29,7 @@ li.right#macro-dropdown
+menu_switch_table("hid-recorder-loop-switch", false, false) Infinite loop playback: +menu_switch_table("hid-recorder-loop-switch", false, false) Infinite loop playback:
hr hr
input#hid-recorder-new-script-file(type="file") input#hid-recorder-new-script-file(type="file" style="display: none")
.buttons.buttons-row .buttons.buttons-row
button.row50#hid-recorder-upload(disabled) Upload script button.row50#hid-recorder-upload(disabled) Upload script

View File

@ -3,7 +3,7 @@ li.right#text-dropdown
+navbar_led("stream-ocr-led", "led-gear", "feature-disabled") +navbar_led("stream-ocr-led", "led-gear", "feature-disabled")
span Text span Text
.menu#text-menu .menu#text-menu(style="width: 360px")
.text .text
b Paste text as keypress sequence#[br] b Paste text as keypress sequence#[br]
sub Please note that PiKVM cannot switch the keyboard layout sub Please note that PiKVM cannot switch the keyboard layout
@ -12,8 +12,8 @@ li.right#text-dropdown
textarea#hid-pak-text(data-focus placeholder="Enter your text here") textarea#hid-pak-text(data-focus placeholder="Enter your text here")
table.kv table.kv
tr tr
td #[button#hid-pak-button(disabled data-force-hide-menu) &bull; Paste] td #[button#hid-pak-button(disabled data-force-hide-menu title="Ctrl+Enter when the text is focused") &bull; Paste]
td using host keymap td using a host keymap
td #[select#hid-pak-keymap-selector] td #[select#hid-pak-keymap-selector]
table.kv table.kv
tr tr
@ -39,8 +39,8 @@ li.right#text-dropdown
td text recognition td text recognition
table.kv table.kv
tr tr
td(colspan="4") &bull; Press #[b Enter] to recognize and copy text to clipboard td(colspan="4") &bull; Next hit the #[b Enter] to recognize and copy text to clipboard...
tr tr
td(colspan="4") &bull; Press #[b Esc] to cancel selection td(colspan="4") &bull; Or hit the #[b Escape] to cancel a selection
tr tr
td td

View File

@ -1,29 +0,0 @@
/*****************************************************************************
# #
# KVMD - The main PiKVM daemon. #
# #
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
# #
*****************************************************************************/
div#text-menu {
width: 340px;
}
input#hid-recorder-new-script-file {
display: none;
}

View File

@ -33,14 +33,23 @@ export function Paste(__recorder) {
/************************************************************************/ /************************************************************************/
var __init__ = function() { var __init__ = function() {
$("hid-pak-text").addEventListener("keyup", function(event) {
if (event.ctrlKey && event.code == "Enter") {
$("hid-pak-button").click();
}
});
tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", true); tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", true);
tools.storage.bindSimpleSwitch($("hid-pak-slow-switch"), "hid.pak.slow", false); tools.storage.bindSimpleSwitch($("hid-pak-slow-switch"), "hid.pak.slow", false);
tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", false, function(value) { tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", false, function(value) {
$("hid-pak-text").style.setProperty("-webkit-text-security", (value ? "disc" : "none")); $("hid-pak-text").style.setProperty("-webkit-text-security", (value ? "disc" : "none"));
}); });
$("hid-pak-keymap-selector").addEventListener("change", function() { $("hid-pak-keymap-selector").addEventListener("change", function() {
tools.storage.set("hid.pak.keymap", $("hid-pak-keymap-selector").value); tools.storage.set("hid.pak.keymap", $("hid-pak-keymap-selector").value);
}); });
tools.el.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton); tools.el.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton);
}; };