Skip to content

Commit 3f77ab6

Browse files
committed
remove codio clipboard methods
1 parent 2637ffe commit 3f77ab6

1 file changed

Lines changed: 1 addition & 56 deletions

File tree

app/ui.js

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ const UI = {
344344
.addEventListener('click', UI.toggleClipboardPanel);
345345
document.getElementById("noVNC_clipboard_text")
346346
.addEventListener('change', UI.clipboardSend);
347-
document.getElementById("noVNC_clipboard_text")
348-
.addEventListener('input', UI.syncClipboardPanelToLocalClipboard);
349347
},
350348

351349
// Add a call to save settings when the element changes,
@@ -975,52 +973,7 @@ const UI = {
975973
* ==============
976974
* CLIPBOARD
977975
* ------v------*/
978-
// Read and write text to local clipboard is currently only supported in Chrome 66+ and Opera53+
979-
// further information at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
980-
981-
writeLocalClipboard(text) {
982-
Log.Debug(">> UI.writeLocalClipboard: " + text.substr(0, 40) + "...");
983-
if (typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.writeText !== "undefined" &&
984-
typeof navigator.permissions !== "undefined" && typeof navigator.permissions.query !== "undefined"
985-
) {
986-
navigator.permissions.query({name: 'clipboard-write'})
987-
.then(() => navigator.clipboard.writeText(text))
988-
.then(() => {
989-
const debugMessage = text.substring(0, 40) + "...";
990-
Log.Debug('>> UI.setClipboardText: navigator.clipboard.writeText with ' + debugMessage);
991-
})
992-
.catch((err) => {
993-
if (err.name !== 'TypeError') {
994-
Log.Error(">> UI.setClipboardText: Failed to write system clipboard (trying to copy from NoVNC clipboard)");
995-
}
996-
});
997-
}
998-
Log.Debug("<< UI.writeLocalClipboard");
999-
},
1000-
1001-
readLocalClipboard() {
1002-
Log.Debug(">> UI.readLocalClipboard");
1003-
// navigator.clipboard and navigator.clipbaord.readText is not available in all browsers
1004-
if (typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.readText !== "undefined" &&
1005-
typeof navigator.permissions !== "undefined" && typeof navigator.permissions.query !== "undefined"
1006-
) {
1007-
navigator.permissions.query({name: 'clipboard-read'})
1008-
.then(() => navigator.clipboard.readText())
1009-
.then((clipboardText) => {
1010-
const text = document.getElementById('noVNC_clipboard_text').value;
1011-
if (clipboardText !== text) {
1012-
document.getElementById('noVNC_clipboard_text').value = clipboardText;
1013-
UI.clipboardSend();
1014-
}
1015-
})
1016-
.catch((err) => {
1017-
if (err.name !== 'TypeError') {
1018-
Log.Warn("<< UI.readLocalClipboard: Failed to read system clipboard-: " + err);
1019-
}
1020-
});
1021-
}
1022-
Log.Debug("<< UI.readLocalClipboard");
1023-
},
976+
1024977
openClipboardPanel() {
1025978
UI.closeAllPanels();
1026979
UI.openControlbar();
@@ -1050,7 +1003,6 @@ const UI = {
10501003
clipboardReceive(e) {
10511004
Log.Debug(">> UI.clipboardReceive: " + e.detail.text.substr(0, 40) + "...");
10521005
document.getElementById('noVNC_clipboard_text').value = e.detail.text;
1053-
UI.writeLocalClipboard(e.detail.text);
10541006
Log.Debug("<< UI.clipboardReceive");
10551007
},
10561008

@@ -1060,12 +1012,6 @@ const UI = {
10601012
UI.rfb.clipboardPasteFrom(text);
10611013
Log.Debug("<< UI.clipboardSend");
10621014
},
1063-
syncClipboardPanelToLocalClipboard() {
1064-
// Reads text from clipboard panel and set it to local clipboard
1065-
// Mainly used to synchronize clipboard panel with local clipboard
1066-
const text = document.getElementById('noVNC_clipboard_text').value;
1067-
UI.writeLocalClipboard(text);
1068-
},
10691015

10701016
/* ------^-------
10711017
* /CLIPBOARD
@@ -1157,7 +1103,6 @@ const UI = {
11571103
UI.rfb.addEventListener("clippingviewport", UI.updateViewDrag);
11581104
UI.rfb.addEventListener("capabilities", UI.updatePowerButton);
11591105
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
1160-
UI.rfb.onCanvasFocus = UI.readLocalClipboard;
11611106
UI.rfb.addEventListener("bell", UI.bell);
11621107
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
11631108
UI.rfb.clipViewport = UI.getSetting('view_clip');

0 commit comments

Comments
 (0)