mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
catch client clipboard errors.
This commit is contained in:
parent
63cad4df72
commit
b7277bc291
@ -269,7 +269,18 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||
protected [EVENT.CLIPBOARD_UPDATED]({ text }: message.ClipboardData) {
|
||||
this._localLog.debug(`EVENT.CLIPBOARD_UPDATED`)
|
||||
Vue.set(this._state.control, 'clipboard', { text })
|
||||
|
||||
try {
|
||||
navigator.clipboard.writeText(text) // sync user's clipboard
|
||||
} catch (error: any) {
|
||||
this._remoteLog.warn(`unable to write text to client's clipboard`, {
|
||||
error,
|
||||
// works only for HTTPs
|
||||
protocol: location.protocol,
|
||||
clipboard: typeof navigator.clipboard,
|
||||
})
|
||||
}
|
||||
|
||||
this.emit('room.clipboard.updated', text)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user