Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto copy-paste with navigator.clipboard API #1301

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ const UI = {
addClipboardHandlers() {
document.getElementById("noVNC_clipboard_button")
.addEventListener('click', UI.toggleClipboardPanel);
document.getElementById("noVNC_clipboard_text")
.addEventListener('input', UI.syncClipboardPanelToLocalClipboard);
akamos marked this conversation as resolved.
Show resolved Hide resolved
document.getElementById("noVNC_clipboard_text")
.addEventListener('change', UI.clipboardSend);
document.getElementById("noVNC_clipboard_clear_button")
Expand Down Expand Up @@ -986,11 +988,17 @@ const UI = {
clipboardSend() {
const text = document.getElementById('noVNC_clipboard_text').value;
Log.Debug(">> UI.clipboardSend: " + text.substr(0, 40) + "...");
UI.writeLocalClipboard(text);
UI.rfb.clipboardPasteFrom(text);
Log.Debug("<< UI.clipboardSend");
},

syncClipboardPanelToLocalClipboard() {
// Reads text from clipboard panel and set it to local clipboard
// Mainly used to synchronize clipboard panel with local clipboard
const text = document.getElementById('noVNC_clipboard_text').value;
UI.writeLocalClipboard(text);
},

/* ------^-------
* /CLIPBOARD
* ==============
Expand Down