GUAC-608: Migrate to streamed inbound clipboard data.
This commit is contained in:
1 parent
13cefc9296
commit
5961dde12f
1 file changed
+22
-2
@@ -1112,8 +1112,28 @@ GuacUI.Client.attach = function(guac) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Server copy handler
|
// Server copy handler
|
||||||
guac.onclipboard = function(data) {
|
guac.onclipboard = function(stream, mimetype) {
|
||||||
GuacUI.sessionState.setProperty("clipboard", data);
|
|
||||||
|
// Only text/plain is supported for now
|
||||||
|
if (mimetype !== "text/plain") {
|
||||||
|
stream.sendAck("Only text/plain supported", Guacamole.Status.Code.UNSUPPORTED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reader = new Guacamole.StringReader(stream);
|
||||||
|
var data = "";
|
||||||
|
|
||||||
|
// Append any received data to buffer
|
||||||
|
reader.ontext = function clipboard_text_received(text) {
|
||||||
|
data += text;
|
||||||
|
stream.sendAck("Received", Guacamole.Status.Code.SUCCESS);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set contents when done
|
||||||
|
reader.onend = function clipboard_text_end() {
|
||||||
|
GuacUI.sessionState.setProperty("clipboard", data);
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in new issue
Block a user