From 67a210f9a4468681bf59ec1321f061cebeef9e72 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 26 Mar 2022 18:04:42 +0800 Subject: [PATCH] set clipboard on js --- src/connection.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/connection.ts b/src/connection.ts index 81389cc84..f59fdc7ba 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -268,7 +268,12 @@ export default class Connection { if (!c) continue; cb.content = c; } - globals.pushEvent("clipboard", cb); + try { + await navigator.clipboard.writeText(new TextDecoder().decode(cb.content)); + } catch (e) { + console.error(e); + } + // globals.pushEvent("clipboard", cb); } else if (msg?.cursor_data) { const cd = msg?.cursor_data; const c = await decompress(cd.colors);