Clipboard copy/paste

634 views
Skip to first unread message

Sun Li

unread,
Aug 18, 2020, 3:39:44 AM8/18/20
to noVNC
The feature of noVNC is "Clipboard copy/paste", why not use "clipboardData" to get the content of the clipboard of the browser, but use the textarea of html to get it.


function handlePaste (e) {
    var clipboardData, pastedData;

    // Stop data actually being pasted into div
    e.stopPropagation();
    e.preventDefault();

    // Get pasted data via clipboard API
    clipboardData = e.clipboardData || window.clipboardData;
    pastedData = clipboardData.getData('Text');
    
    // Do whatever with pasteddata
    console.log('patse', pastedData);
}


document.addEventListener('paste', handlePaste);

Samuel Mannehed

unread,
Aug 19, 2020, 7:19:23 PM8/19/20
to Sun Li, no...@googlegroups.com
Hi Sun Li,

> The feature of noVNC is "Clipboard copy/paste", why not use
> "clipboardData" to get the content of the clipboard of the browser,
> but use the textarea of html to get it.

There is an open pull request on the subject on github. Feel free to
pitch in or help out over there.

Best regards,
--
Samuel Mannehed Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46 13 214 600
Reply all
Reply to author
Forward
0 new messages