[Libreoffice-commits] online.git: loleaflet/js loleaflet/src
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 8 17:21:32 UTC 2020
loleaflet/js/global.js | 8 ++++++++
loleaflet/src/main.js | 4 ----
loleaflet/src/map/handler/Map.TouchGesture.js | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
New commits:
commit e9d11f4a6605809d52d4205ec9ff91a6ffef143b
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Jan 7 14:04:14 2020 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Wed Jan 8 18:21:14 2020 +0100
loleaflet: simplify "prevent default 'contextmenu' action"
The mobile and desktop prevents default 'contextmenu' action
Change-Id: I89171c955c153b2fceaad92970e2eaf039cb8527
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86373
Reviewed-by: Henry Castro <hcastro at collabora.com>
Tested-by: Henry Castro <hcastro at collabora.com>
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index b3b619f8c..8445ecb4f 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -1,6 +1,14 @@
/* -*- js-indent-level: 8 -*- */
(function (global) {
+ document.addEventListener('contextmenu', function(e) {
+ if (e.preventDefault) {
+ e.preventDefault();
+ } else {
+ e.returnValue = false;
+ }
+ }, false);
+
global.fakeWebSocketCounter = 0;
global.FakeWebSocket = function () {
this.binaryType = 'arraybuffer';
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index fb7890b36..ba500fd09 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -91,10 +91,6 @@ window.addEventListener('beforeunload', function () {
}
});
-if (!L.Browser.mobile) {
- L.DomEvent.on(document, 'contextmenu', L.DomEvent.preventDefault);
-}
-
window.bundlejsLoaded = true;
}(window));
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 66c333791..f6f22761e 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -62,7 +62,7 @@ L.Map.TouchGesture = L.Handler.extend({
}
L.DomEvent.on(this._map._mapPane, 'mousedown mousemove mouseup', L.DomEvent.preventDefault);
- L.DomEvent.on(document, 'contextmenu touchmove', L.DomEvent.preventDefault);
+ L.DomEvent.on(document, 'touchmove', L.DomEvent.preventDefault);
}
for (var events in L.Draggable.MOVE) {
More information about the Libreoffice-commits
mailing list