diff options
author | Henry Castro <hcastro@collabora.com> | 2019-04-18 18:26:33 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2019-04-26 15:36:28 +0200 |
commit | 71496cfdb25bee9da6a8370c8adee73248cc90fe (patch) | |
tree | d0b3d6b2aaa83ec598f7cd8da518ffcdcbcfb131 | |
parent | 6bb4edd62ce5d20ef0c2ddc648acd17f35bf1008 (diff) |
loleaflet: add 'paste' event listener to dialog
Change-Id: I2ec69117683e4dd75722b1873a373ee6b7ec7782
Reviewed-on: https://gerrit.libreoffice.org/70961
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | loleaflet/src/control/Control.LokDialog.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 4222800ec..bc30c2e02 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -455,6 +455,30 @@ L.Control.LokDialog = L.Control.extend({ // Keep map active while user is playing with window. this._map.lastActiveTime = Date.now(); }, this); + L.DomEvent.on(dlgInput, 'paste', function(e) { + var clipboardData = e.clipboardData || window.clipboardData; + var data, blob; + + L.DomEvent.preventDefault(e); + if (clipboardData) { + data = clipboardData.getData('text/plain') || clipboardData.getData('Text'); + if (data) { + var cmd = { + MimeType: { + type: 'string', + value: 'mimetype=text/plain;charset=utf-8' + }, + Data: { + type: '[]byte', + value: data + } + }; + + blob = new Blob(['windowcommand ' + id + ' paste ', unescape(encodeURIComponent(JSON.stringify(cmd)))]); + this._map._socket.sendMessage(blob); + } + } + }, this); L.DomEvent.on(dlgInput, 'contextmenu', function() { return false; }); |