[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/dist loleaflet/main.js loleaflet/src

Henry Castro hcastro at collabora.com
Tue Jul 3 21:09:28 UTC 2018


 loleaflet/dist/toolbar/toolbar.js |    5 -----
 loleaflet/main.js                 |    2 ++
 loleaflet/src/map/Map.js          |    8 +++-----
 3 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 5a949f5933c766f333cd925f39a10185bd1d5214
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Jul 1 17:08:06 2018 -0400

    loleaflet: disable default context menu, part 2
    
    Change-Id: I92548bffdfd96811155560b77ff28e49f3289ba4
    Reviewed-on: https://gerrit.libreoffice.org/56782
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index f16a5d16c..6185cc213 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -519,7 +519,6 @@ $(function () {
 			insertTable();
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['toolbar-up'].touchStarted = true;
 	});
@@ -549,7 +548,6 @@ $(function () {
 			$('#formulaInput').off('focus', onFormulaBarFocus).on('focus', onFormulaBarFocus);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['formulabar'].touchStarted = true;
 	});
@@ -575,7 +573,6 @@ $(function () {
 			hideTooltip(this, e.target);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['spreadsheet-toolbar'].touchStarted = true;
 	});
@@ -598,7 +595,6 @@ $(function () {
 			hideTooltip(this, e.target);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['presentation-toolbar'].touchStarted = true;
 	});
@@ -667,7 +663,6 @@ $(function () {
 			$('#search-input').off('keydown', onSearchKeyDown).on('keydown', onSearchKeyDown);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['toolbar-down'].touchStarted = true;
 	});
diff --git a/loleaflet/main.js b/loleaflet/main.js
index 0438a818e..efbfd32ba 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -139,4 +139,6 @@ window.addEventListener('beforeunload', function () {
 		global.map._socket.close();
 	}
 });
+
+L.DomEvent.on(document, 'contextmenu', L.DomEvent.preventDefault);
 //require('./dist/toolbar/toolbar');
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 95880c6da..b3ef7730b 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -89,10 +89,6 @@ L.Map = L.Evented.extend({
 		this._clipboardContainer = L.clipboardContainer();
 		this.addLayer(this._clipboardContainer);
 
-		// Inhibit the context menu - the browser thinks that the document
-		// is just a bunch of images, hence the context menu is useless (tdf#94599)
-		this.on('contextmenu', function() {});
-
 		// When all these conditions are met, fire statusindicator:initializationcomplete
 		this.initConditions = {
 			'doclayerinit': false,
@@ -706,6 +702,8 @@ L.Map = L.Evented.extend({
 		this._fileDownloader = L.DomUtil.create('iframe', '', container);
 		L.DomUtil.setStyle(this._fileDownloader, 'display', 'none');
 
+		L.DomEvent.on(this._resizeDetector.contentWindow, 'contextmenu', L.DomEvent.preventDefault);
+		L.DomEvent.on(this._fileDownloader.contentWindow, 'contextmenu', L.DomEvent.preventDefault);
 		L.DomEvent.addListener(container, 'scroll', this._onScroll, this);
 		container._leaflet = true;
 	},
@@ -830,7 +828,7 @@ L.Map = L.Evented.extend({
 		var onOff = remove ? 'off' : 'on';
 
 		L.DomEvent[onOff](this._container, 'click dblclick mousedown mouseup ' +
-			'mouseover mouseout mousemove contextmenu dragover drop ' +
+			'mouseover mouseout mousemove dragover drop ' +
 			'trplclick qdrplclick', this._handleDOMEvent, this);
 
 		if (this.options.trackResize && this._resizeDetector.contentWindow) {


More information about the Libreoffice-commits mailing list