/usr/share/novnc-pve/app.js
clipboardPasteFrom(text) {
if (this._rfb_connection_state !== 'connected' || this._viewOnly) {
console.log("noconnect");
return; }
$$$core$rfb$$RFB.messages.clientCutText(this._sock, text);
for (let lt of text) {
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(lt) !== -1
var shift = $$$core$input$keysym$$default.XK_Shift_L; // To help with minification
if (needs_shift) {
this.sendKey(shift,"XK_Shift_L", true);
}
this.sendKey(lt.charCodeAt(),lt, true);
this.sendKey(lt.charCodeAt(),lt, false);
if (needs_shift) {
this.sendKey(shift,"XK_Shift_L", false);
}
}
document.getElementById('noVNC_clipboard_text').value = "";
}
// show/hide the buttons
document.getElementById('noVNC_disconnect_button')
.classList.add('noVNC_hidden');
if (me.consoletype === 'kvm') {
document.getElementById('noVNC_clipboard_button')
//.classList.add('noVNC_hidden'); //comment this
}
if (me.consoletype === 'shell' || me.consoletype === 'upgrade') {
document.getElementById('pve_commands_button')
// .classList.add('noVNC_hidden'); //comment this
}
/usr/share/novnc-pve/index.html.tpl
<div id="noVNC_clipboard" class="noVNC_panel">
<div class="noVNC_heading">
<img src="/novnc/app/images/clipboard.svg"> Clipboard
</div>
<textarea id="noVNC_clipboard_text" rows=5></textarea>
<br />
<input id="noVNC_clipboard_button" type="button"
value="粘贴" class="noVNC_submit" />
<input id="noVNC_clipboard_clear_button" type="button"
value="Clear" class="noVNC_submit" />
</div>