[Libreoffice-commits] online.git: loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Apr 26 13:36:47 UTC 2019


 loleaflet/src/control/Control.LokDialog.js |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 71496cfdb25bee9da6a8370c8adee73248cc90fe
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Apr 18 18:26:33 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Fri Apr 26 15:36:28 2019 +0200

    loleaflet: add 'paste' event listener to dialog
    
    Change-Id: I2ec69117683e4dd75722b1873a373ee6b7ec7782
    Reviewed-on: https://gerrit.libreoffice.org/70961
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

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;
 		});


More information about the Libreoffice-commits mailing list