Add 'RFB::clipboardreceived' event

This commit is contained in:
Daniel Hammerschmidt 2025-11-11 23:26:18 +01:00
parent 6cda832b8f
commit 817c1dee5f
2 changed files with 13 additions and 5 deletions

View File

@ -2335,11 +2335,13 @@ export default class RFB extends EventTargetMixin {
_writeClipboard(text) { _writeClipboard(text) {
if (this._viewOnly) return; if (this._viewOnly) return;
if (this._asyncClipboard.writeClipboard(text)) return; if (!(this._asyncClipboard.writeClipboard(text))) {
// Fallback clipboard // Fallback clipboard
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("clipboard", {detail: {text: text}}) new CustomEvent("clipboard", {detail: {text: text}})
); );
}
this.dispatchEvent(new CustomEvent("clipboardreceived"));
} }
_handleServerCutText() { _handleServerCutText() {

View File

@ -96,6 +96,12 @@ protocol stream.
- The `clipboard` event is fired when clipboard data is received from - The `clipboard` event is fired when clipboard data is received from
the server. the server.
['clipboardreceived'](#clipboardreceived)
- The `clipboardreceived` event is fired after the `clipboard` event
or after the clipboard has been updated through the
[Clipboard module](API-internal.md#11-module-list). The copied text
has already been written to the system clipboard or the clipboard panel.
[`clippingviewport`](#clippingviewport) [`clippingviewport`](#clippingviewport)
- The `clippingviewport` event is fired when `RFB.clippingViewport` is - The `clippingviewport` event is fired when `RFB.clippingViewport` is
updated. updated.