Skip to content

Commit

Permalink
Merge pull request #363 from OSC/undo-copy-paste-hack
Browse files Browse the repository at this point in the history
Undo bugged copy-paste hack
  • Loading branch information
MorganRodgers authored Dec 20, 2019
2 parents bee35f9 + 5ad88cc commit b863f1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 61 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [1.7.6] - 2019-12-20
### Fixed
- Remove Async ClipboardAPI (noVNC copy/paste hack) due to noVNC freezes [#356](https://github.com/OSC/ondemand/pull/356)
- Fix missing favicon [#322](https://github.com/OSC/ondemand/pull/322)
- Remove hidden/dot files from JobComposer's file list [#346](https://github.com/OSC/ondemand/pull/346)

## [1.7.5] - 2019-12-11
### Added
- use Async ClipboardAPI for better copy and paste with Chrome and NoVNC [#335](https://github.com/OSC/ondemand/pull/335)
Expand Down Expand Up @@ -331,7 +337,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- From 1.3.7 - 1.4.2 updated app versions


[Unreleased]: https://github.com/OSC/ondemand/compare/v1.7.5...HEAD
[Unreleased]: https://github.com/OSC/ondemand/compare/v1.7.6...HEAD
[1.7.6]: https://github.com/OSC/ondemand/compare/v1.7.5...v1.7.6
[1.7.5]: https://github.com/OSC/ondemand/compare/v1.7.4...v1.7.5
[1.7.4]: https://github.com/OSC/ondemand/compare/v1.7.3...v1.7.4
[1.7.3]: https://github.com/OSC/ondemand/compare/v1.7.2...v1.7.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,6 @@ var UI = {
document.getElementById("noVNC_clipboard_button").addEventListener('click', UI.toggleClipboardPanel);
document.getElementById("noVNC_clipboard_text").addEventListener('change', UI.clipboardSend);
document.getElementById("noVNC_clipboard_clear_button").addEventListener('click', UI.clipboardClear);

document.getElementById("noVNC_clipboard_text").addEventListener('input', UI.syncClipboardPanelToLocalClipboard);
},

// Add a call to save settings when the element changes,
Expand Down Expand Up @@ -1054,49 +1052,6 @@ var UI = {
* CLIPBOARD
* ------v------*/

// Read and write text to local clipboard is currently only supported in Chrome 66+ and Opera53+
// further information at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard

writeLocalClipboard(text) {
if (typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.writeText !== "undefined" &&
typeof navigator.permissions !== "undefined" && typeof navigator.permissions.query !== "undefined"
) {
navigator.permissions.query({name: 'clipboard-write'})
.then(() => navigator.clipboard.writeText(text))
.then(() => {
let debugMessage = text.substr(0, 40) + "...";
Log.Debug('>> UI.setClipboardText: navigator.clipboard.writeText with ' + debugMessage);
})
.catch((err) => {
if(err.name !== 'TypeError'){
Log.Error(">> UI.setClipboardText: Failed to write system clipboard (trying to copy from NoVNC clipboard)");
}
});
}
},

readLocalClipboard() {
// navigator.clipboard and navigator.clipbaord.readText is not available in all browsers
if (typeof navigator.clipboard !== "undefined" && typeof navigator.clipboard.readText !== "undefined" &&
typeof navigator.permissions !== "undefined" && typeof navigator.permissions.query !== "undefined"
) {
navigator.permissions.query({name: 'clipboard-read'})
.then(() => navigator.clipboard.readText())
.then((clipboardText) => {
const text = document.getElementById('noVNC_clipboard_text').value;
if (clipboardText !== text) {
document.getElementById('noVNC_clipboard_text').value = clipboardText;
UI.clipboardSend();
}
})
.catch((err) => {
if(err.name !== 'TypeError'){
Log.Warn("<< UI.readLocalClipboard: Failed to read system clipboard-: " + err);
}
});
}
},

openClipboardPanel: function () {
UI.closeAllPanels();
UI.openControlbar();
Expand All @@ -1121,13 +1076,11 @@ var UI = {
clipboardReceive: function (e) {
Log.Debug(">> UI.clipboardReceive: " + e.detail.text.substr(0, 40) + "...");
document.getElementById('noVNC_clipboard_text').value = e.detail.text;
UI.writeLocalClipboard(e.detail.text);
Log.Debug("<< UI.clipboardReceive");
},

clipboardClear: function () {
document.getElementById('noVNC_clipboard_text').value = "";
UI.writeLocalClipboard("");
UI.rfb.clipboardPasteFrom("");
},

Expand All @@ -1137,12 +1090,6 @@ var UI = {
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 Expand Up @@ -1212,9 +1159,6 @@ var UI = {
UI.updatePowerButton();
});
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);

UI.rfb.oncanvasfocus = UI.readLocalClipboard;

UI.rfb.addEventListener("bell", UI.bell);
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
UI.rfb.clipViewport = UI.getSetting('view_clip');
Expand Down Expand Up @@ -6524,8 +6468,6 @@ function RFB(target, url, options) {
// time to set up callbacks
setTimeout(this._updateConnectionState.bind(this, 'connecting'));

this.oncanvasfocus = () => {}; // Handler for canvas focused

Log.Debug("<< RFB.constructor");
};

Expand Down Expand Up @@ -6673,7 +6615,6 @@ RFB.prototype = {
},

focus: function () {
this.oncanvasfocus();
this._canvas.focus();
},

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/public/noVNC-1.0.0/vnc.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<script type="text/javascript" src="shims/[email protected]"></script>

<!-- begin scripts -->
<script src="app.v2.js"></script>
<script src="app.v3.js"></script>
<!-- end scripts -->
</head>

Expand Down

0 comments on commit b863f1c

Please sign in to comment.