思路主要参考https://www.cnblogs.com/redirect/p/10066730.html
在modules/client.js中能找到onclipboard的定义 于是在相应位置进行修改
//监听堡垒机端往剪切板复制事件,然后写入文本框中
this.onclipboard = function(stream, mimetype){
if (/^text\//.exec(mimetype)) {
var stringReader = new Guacamole.StringReader(stream);
var json = "";
stringReader.ontext = function ontext(text) {
json += text
}
stringReader.onend = function() {
guac_client.clipboardData = '';
guac_client.clipboardData = json;
}
}
}
//将内容传送到往堡垒机,data是获取到的文本框中的内容
function setClipboard(data) {
var stream = client.createClipboardStream("text/plain");
var writer = new Guacamole.StringWriter(stream);
for (var i=0; i<data.length; i += 4096){
writer.sendText(data.su