Replace clipboard text input with button.

This commit is contained in:
Jared Goodwin 2020-04-20 15:16:38 -07:00
parent a8df6939c7
commit e3bb8fb505
7 changed files with 23 additions and 31 deletions

View File

@ -144,10 +144,8 @@
<div style="color:white; font-size:12px">
Shared Clipboard
</div>
<textarea id="clipboardTransferTextArea"></textarea>
<div style="color:white; font-size:12px; text-align: left">
<input id="clipboardTransferTypeCheckbox" type="checkbox" />
<label for="clipboardTransferTypeCheckbox">Type Input</label>
<div style="color:white; font-size:12px;">
<button id="typeClipboardButton" class="horizontal-bar-button">Type Clipboard</button>
</div>
</div>

View File

@ -1,4 +1,3 @@
import { ClipboardTransferTextArea } from "./UI.js";
import { MainRc } from "./Main.js";
export class ClipboardWatcher {
WatchClipboard() {
@ -14,7 +13,6 @@ export class ClipboardWatcher {
navigator.clipboard.readText().then(newText => {
if (this.LastClipboardText != newText) {
this.LastClipboardText = newText;
ClipboardTransferTextArea.value = newText;
MainRc.MessageSender.SendClipboardTransfer(newText, false);
}
});
@ -25,7 +23,6 @@ export class ClipboardWatcher {
this.PauseMonitoring = true;
this.LastClipboardText = text;
navigator.clipboard.writeText(text);
ClipboardTransferTextArea.value = text;
this.PauseMonitoring = false;
}
}

View File

@ -1 +1 @@
{"version":3,"file":"ClipboardWatcher.js","sourceRoot":"","sources":["ClipboardWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,OAAO,gBAAgB;IAKzB,cAAc;QACV,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC9C,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;YAErC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;gBACnC,IAAI,IAAI,CAAC,eAAe,EAAE;oBACtB,OAAO;iBACV;gBACD,IAAI,CAAC,QAAQ,C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AAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBAC1C,IAAI,IAAI,CAAC,iBAAiB,IAAI,OAAO,EAAE;wBACnC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;wBACjC,MAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;qBAC9D;gBACL,CAAC,CAAC,CAAA;YACN,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gBAAgB,CAAC,IAAY;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;CACJ"}

View File

@ -1,5 +1,4 @@
import { ClipboardTransferTextArea } from "./UI.js";
import { MainRc } from "./Main.js";
import { MainRc } from "./Main.js";
export class ClipboardWatcher {
ClipboardTimer: number;
@ -21,7 +20,6 @@ export class ClipboardWatcher {
navigator.clipboard.readText().then(newText => {
if (this.LastClipboardText != newText) {
this.LastClipboardText = newText;
ClipboardTransferTextArea.value = newText;
MainRc.MessageSender.SendClipboardTransfer(newText, false);
}
})
@ -33,7 +31,6 @@ export class ClipboardWatcher {
this.PauseMonitoring = true;
this.LastClipboardText = text;
navigator.clipboard.writeText(text);
ClipboardTransferTextArea.value = text;
this.PauseMonitoring = false;
}
}

View File

@ -34,9 +34,8 @@ export var FileTransferButton = document.getElementById("fileTransferButton");
export var CtrlAltDelButton = document.getElementById("ctrlAltDelButton");
export var TouchKeyboardTextArea = document.getElementById("touchKeyboardTextArea");
export var ClipboardTransferBar = document.getElementById("clipboardTransferBar");
export var ClipboardTransferTextArea = document.getElementById("clipboardTransferTextArea");
export var ClipboardTransferButton = document.getElementById("clipboardTransferButton");
export var ClipboardTransferTypeCheckbox = document.getElementById("clipboardTransferTypeCheckbox");
export var TypeClipboardButton = document.getElementById("typeClipboardButton");
export var ConnectionP2PIcon = document.getElementById("connectionP2PIcon");
export var ConnectionRelayedIcon = document.getElementById("connectionRelayedIcon");
export var ToastsWrapper = document.getElementById("toastsWrapper");
@ -66,13 +65,14 @@ export function ApplyInputHandlers() {
closeAllHorizontalBars("clipboardTransferBar");
ClipboardTransferBar.classList.toggle("open");
});
ClipboardTransferTextArea.addEventListener("input", (ev) => {
if (ClipboardTransferTextArea.value.length == 0) {
return;
}
MainRc.MessageSender.SendClipboardTransfer(ClipboardTransferTextArea.value, ClipboardTransferTypeCheckbox.checked);
ClipboardTransferTextArea.blur();
ShowMessage("Clipboard sent!");
TypeClipboardButton.addEventListener("click", (ev) => {
navigator.clipboard.readText().then(text => {
MainRc.MessageSender.SendClipboardTransfer(text, true);
ShowMessage("Clipboard sent!");
}, reason => {
alert("Unable to read clipboard. Please check your permissions.");
console.log("Unable to read clipboard. Reason: " + reason);
});
});
ConnectButton.addEventListener("click", (ev) => {
MainRc.ConnectToClient();

File diff suppressed because one or more lines are too long

View File

@ -38,9 +38,8 @@ export var FileTransferButton = document.getElementById("fileTransferButton") as
export var CtrlAltDelButton = document.getElementById("ctrlAltDelButton") as HTMLButtonElement;
export var TouchKeyboardTextArea = document.getElementById("touchKeyboardTextArea") as HTMLTextAreaElement;
export var ClipboardTransferBar = document.getElementById("clipboardTransferBar") as HTMLDivElement;
export var ClipboardTransferTextArea = document.getElementById("clipboardTransferTextArea") as HTMLTextAreaElement;
export var ClipboardTransferButton = document.getElementById("clipboardTransferButton") as HTMLButtonElement;
export var ClipboardTransferTypeCheckbox = document.getElementById("clipboardTransferTypeCheckbox") as HTMLInputElement;
export var TypeClipboardButton = document.getElementById("typeClipboardButton") as HTMLButtonElement;
export var ConnectionP2PIcon = document.getElementById("connectionP2PIcon") as HTMLElement;
export var ConnectionRelayedIcon = document.getElementById("connectionRelayedIcon") as HTMLElement;
export var ToastsWrapper = document.getElementById("toastsWrapper") as HTMLDivElement;
@ -72,13 +71,14 @@ export function ApplyInputHandlers() {
closeAllHorizontalBars("clipboardTransferBar");
ClipboardTransferBar.classList.toggle("open");
});
ClipboardTransferTextArea.addEventListener("input", (ev) => {
if (ClipboardTransferTextArea.value.length == 0) {
return;
}
MainRc.MessageSender.SendClipboardTransfer(ClipboardTransferTextArea.value, ClipboardTransferTypeCheckbox.checked);
ClipboardTransferTextArea.blur();
ShowMessage("Clipboard sent!");
TypeClipboardButton.addEventListener("click", (ev) => {
navigator.clipboard.readText().then(text => {
MainRc.MessageSender.SendClipboardTransfer(text, true);
ShowMessage("Clipboard sent!");
}, reason => {
alert("Unable to read clipboard. Please check your permissions.");
console.log("Unable to read clipboard. Reason: " + reason);
});
});
ConnectButton.addEventListener("click", (ev) => {
MainRc.ConnectToClient();