Skip to content

Commit

Permalink
cosmetic: undo some pointless line wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed May 14, 2024
1 parent 99a5039 commit eb54346
Showing 1 changed file with 8 additions and 34 deletions.
42 changes: 8 additions & 34 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ class XpraClient {
) {
this.clipboard_targets.push("image/png");
} else {
this.log(
"no clipboard write support: no images, navigator.clipboard=",
navigator.clipboard
);
this.log("no clipboard write support: no images, navigator.clipboard=", navigator.clipboard);
}
// printing / file-transfer:
this.remote_printing = false;
Expand Down Expand Up @@ -1837,8 +1834,7 @@ class XpraClient {
button = 9;
}
setTimeout(() => {
this.clipboard_delayed_event_time =
performance.now() + CLIPBOARD_EVENT_DELAY;
this.clipboard_delayed_event_time = performance.now() + CLIPBOARD_EVENT_DELAY;
this.send_button_action(wid, button, pressed, coords, modifiers);
}, send_delay);
}
Expand Down Expand Up @@ -2064,59 +2060,37 @@ class XpraClient {
const pasteboard = $(PASTEBOARD_SELECTOR);
pasteboard.text(clipboard_buffer);
pasteboard.select();
this.cdebug(
"clipboard",
"copy event, clipboard buffer=",
clipboard_buffer
);
this.cdebug("clipboard", "copy event, clipboard buffer=", clipboard_buffer);
this.clipboard_pending = false;
});
window.addEventListener("cut", (e) => {
const clipboard_buffer = this.get_clipboard_buffer();
const pasteboard = $(PASTEBOARD_SELECTOR);
pasteboard.text(clipboard_buffer);
pasteboard.select();
this.cdebug(
"clipboard",
"cut event, clipboard buffer=",
clipboard_buffer
);
this.cdebug("clipboard", "cut event, clipboard buffer=", clipboard_buffer);
this.clipboard_pending = false;
});
$("#screen").on("click", (e) => this.may_set_clipboard());
$("#screen").keypress(() => this.may_set_clipboard());
}

may_set_clipboard(e) {
this.cdebug(
"clipboard",
"pending=",
this.clipboard_pending,
"buffer=",
truncate(this.clipboard_buffer)
);
this.cdebug("clipboard", "pending=", this.clipboard_pending, "buffer=", truncate(this.clipboard_buffer));
if (!this.clipboard_pending) {
return;
}
let clipboard_buffer = this.get_clipboard_buffer();
const clipboard_datatype = (
this.get_clipboard_datatype() || ""
).toLowerCase();
const is_text =
clipboard_datatype.includes("text") ||
clipboard_datatype.includes("string");
const clipboard_datatype = (this.get_clipboard_datatype() || "").toLowerCase();
const is_text = clipboard_datatype.includes("text") || clipboard_datatype.includes("string");
if (!is_text) {
//maybe just abort here instead?
clipboard_buffer = "";
}
const pasteboard = $(PASTEBOARD_SELECTOR);
pasteboard.text(clipboard_buffer);
pasteboard.select();
this.cdebug(
"clipboard",
"click event, with pending clipboard datatype=",
clipboard_datatype,
", buffer=",
this.cdebug("clipboard", "click event, with pending clipboard datatype=", clipboard_datatype, ", buffer=",
clipboard_buffer
);
let success = false;
Expand Down

0 comments on commit eb54346

Please sign in to comment.