add ctrl+c ctrl+x and esc to mobile terminal ui
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Sep 24, 2024 at 20:00 UTC
61fb6898c0424b29bee5c91a1faa350d85e5b741
2 files changed
+29
translate/translate.json
+3
@@ -21564,6 +21564,7 @@
21564
"zh-cht": "Ctl-C",
21565
"uk": "Ctl-C",
21566
"xloc": [
21567
+ "default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
21568
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
21569
"sharing.handlebars->p12->9->3"
21570
]
@@ -21594,6 +21595,7 @@
21595
"zh-cht": "Ctl-X",
21596
"uk": "Ctl-X",
21597
"xloc": [
21598
+ "default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
21599
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
21600
"sharing.handlebars->p12->9->3"
21601
]
@@ -28451,6 +28453,7 @@
28453
"zh-cht": "ESC",
28454
"uk": "ESC",
28455
"xloc": [
28456
+ "default-mobile.handlebars->container->page_content->column_l->p10->p10terminal->termTable->termarea4->1->3",
28457
"default.handlebars->container->column_l->p11->deskarea0->deskarea4->5",
28458
"default.handlebars->container->column_l->p12->termTable->1->1->4->1->3",
28459
"sharing.handlebars->p12->9->3"
views/default-mobile.handlebars
+26
@@ -989,6 +989,9 @@
989
<div class="toright2"></div>
990
<div style="height:28px">
991
<input id="termActionsBtn" style="margin-left:3px;height:28px" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() />
992
+ <input id="ctrlcbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="Ctl-C" onclick="termSendKey(3,'ctrlcbutton')" />
993
+ <input id="ctrlxbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="Ctl-X" onclick="termSendKey(24,'ctrlxbutton')" />
994
+ <input id="escbutton" style="margin-left:3px;height:28px" type=button onkeypress="return false" onkeydown="return false" value="ESC" onclick="termSendKey(27,'escbutton')" />
995
</div>
996
</div>
997
</div>
@@ -5148,6 +5151,9 @@
5151
5152
// Enable action button if mesh type is not "local devices"
5153
QV('termActionsBtn', terminalNode.mtype != 3);
5154
+ QE('ctrlcbutton', termState);
5155
+ QE('ctrlxbutton', termState);
5156
+ QE('escbutton', termState);
5157
if (((termState == true) && (terminal.contype != 3)) || (terminalNode.agent == null) || (terminalNode.agent.id == 3) || (terminalNode.agent.id == 4)) {
5158
QH('terminalCustomUpperRight', '');
5159
} else {
@@ -5467,6 +5473,26 @@
5473
Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
5474
}
5475
5476
+ function termSendKey(key, id) {
5477
+ if (!terminal || xxdialogMode) return;
5478
+ if (xterm != null) {
5479
+ if (terminal.urlname == 'sshterminalrelay.ashx') {
5480
+ // SSH
5481
+ terminal.socket.send('~' + String.fromCharCode(key));
5482
+ } else if (terminal.sendText) {
5483
+ // MeshAgent
5484
+ terminal.sendText(String.fromCharCode(key));
5485
+ } else {
5486
+ // CIRA
5487
+ terminal.send(String.fromCharCode(key));
5488
+ }
5489
+ xterm.focus();
5490
+ } else if (terminal != null) {
5491
+ terminal.m.TermSendKey(key);
5492
+ Q(id).blur(); // Deselect the connect button so the button does not get key presses.
5493
+ }
5494
+ }
5495
+
5496
//
5497
// Terminal Shortcut Keys
5498
//