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

Henry Castro hcastro at collabora.com
Sun Jul 1 21:50:17 UTC 2018


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

New commits:
commit 68ce5cac97b6c8754e8b68fec2b0b187008305f7
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

diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index cc1682338..ad38b45ca 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -86,4 +86,6 @@ window.addEventListener('beforeunload', function () {
 	}
 });
 
+L.DomEvent.on(document, 'contextmenu', L.DomEvent.preventDefault);
+
 }(window));
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 3a11ca28d..387913c67 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -695,7 +695,6 @@ function createToolbar() {
 			insertShapes();
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['toolbar-up'].touchStarted = true;
 	});
@@ -725,7 +724,6 @@ function createToolbar() {
 			$('#formulaInput').off('focus', onFormulaBarFocus).on('focus', onFormulaBarFocus);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['formulabar'].touchStarted = true;
 	});
@@ -751,7 +749,6 @@ function createToolbar() {
 			hideTooltip(this, e.target);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['spreadsheet-toolbar'].touchStarted = true;
 	});
@@ -774,7 +771,6 @@ function createToolbar() {
 			hideTooltip(this, e.target);
 		}
 	});
-	toolbar.contextmenu(function() { return false; });
 	toolbar.bind('touchstart', function() {
 		w2ui['presentation-toolbar'].touchStarted = true;
 	});
@@ -843,7 +839,6 @@ function createToolbar() {
 			$('#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/src/map/Map.js b/loleaflet/src/map/Map.js
index 425c9df24..609153900 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -90,10 +90,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,
@@ -707,6 +703,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;
 	},
@@ -831,7 +829,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