termites 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +25 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -725,6 +725,9 @@ class TermitesServer {
|
|
|
725
725
|
<button data-seq="\\x04">^D</button>
|
|
726
726
|
<button data-seq="\\x1a">^Z</button>
|
|
727
727
|
<button data-seq="\\x0c">^L</button>
|
|
728
|
+
<div class="sep"></div>
|
|
729
|
+
<button id="copy-btn">Copy</button>
|
|
730
|
+
<button id="paste-btn">Paste</button>
|
|
728
731
|
</div>
|
|
729
732
|
|
|
730
733
|
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.min.js"></script>
|
|
@@ -1030,6 +1033,28 @@ class TermitesServer {
|
|
|
1030
1033
|
btn.addEventListener('touchstart', handler, { passive: false });
|
|
1031
1034
|
btn.addEventListener('click', handler);
|
|
1032
1035
|
});
|
|
1036
|
+
|
|
1037
|
+
// Copy button - copy selection or last line
|
|
1038
|
+
document.getElementById('copy-btn').addEventListener('click', async () => {
|
|
1039
|
+
const selection = term.getSelection();
|
|
1040
|
+
if (selection) {
|
|
1041
|
+
await navigator.clipboard.writeText(selection);
|
|
1042
|
+
term.clearSelection();
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
|
|
1046
|
+
// Paste button
|
|
1047
|
+
document.getElementById('paste-btn').addEventListener('click', async () => {
|
|
1048
|
+
try {
|
|
1049
|
+
const text = await navigator.clipboard.readText();
|
|
1050
|
+
if (text && ws?.readyState === WebSocket.OPEN && selectedClientId) {
|
|
1051
|
+
ws.send(JSON.stringify({ type: 'input', clientId: selectedClientId, text }));
|
|
1052
|
+
}
|
|
1053
|
+
} catch (e) {
|
|
1054
|
+
console.error('Paste failed:', e);
|
|
1055
|
+
}
|
|
1056
|
+
term.focus();
|
|
1057
|
+
});
|
|
1033
1058
|
}
|
|
1034
1059
|
|
|
1035
1060
|
function updateClientList() {
|