[Libreoffice-commits] online.git: 7 commits - loleaflet/src wsd/reference.txt
Pranav Kant
pranavk at collabora.co.uk
Wed Dec 14 13:42:41 UTC 2016
loleaflet/src/core/Browser.js | 109 ++++++++++++++++++++++++++++++---
loleaflet/src/layer/tile/TileLayer.js | 3
loleaflet/src/map/handler/Map.Print.js | 6 +
wsd/reference.txt | 4 +
4 files changed, 109 insertions(+), 13 deletions(-)
New commits:
commit 7c6d4719dabbaf479c4e7f7bb56c26970a7e6371
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 19:06:26 2016 +0530
loleaflet: Print dialog for MS edge too
MS Edge seems to be very problematic when one tries to load the
pdf blob into the print iframe and issue a print command to it.
Lets fallback to print prompt as we have in firefox
Change-Id: I97fc394d0053030231c524efb6bf808d32a9aa07
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index d93ed2e..0f5ca9f 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -465,7 +465,7 @@ L.TileLayer = L.GridLayer.extend({
this._map.hideBusy();
if (command.id === 'print') {
- if (L.Browser.gecko || this._map.options.print === false) {
+ if (L.Browser.gecko || L.Browser.edge || this._map.options.print === false) {
// the print dialog doesn't work well on firefox
this._map.fire('print', {url: url});
}
commit 1bfbd6990cbc289734d06776326ca1ecefb1ce90
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 19:05:34 2016 +0530
loleaflet: Reuse L.Browser instead of our own logic
Change-Id: I479d6aa3de657ba032e3bb7e5039d5744a859163
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index a4856f1..d93ed2e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -465,8 +465,7 @@ L.TileLayer = L.GridLayer.extend({
this._map.hideBusy();
if (command.id === 'print') {
- var isFirefox = typeof InstallTrigger !== 'undefined' || navigator.userAgent.search('Firefox') >= 0;
- if (isFirefox || this._map.options.print === false) {
+ if (L.Browser.gecko || this._map.options.print === false) {
// the print dialog doesn't work well on firefox
this._map.fire('print', {url: url});
}
commit a0036f24bac8fdfd67055935aa756c873db30fe7
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 19:03:13 2016 +0530
Pick changes from upstream Leaflet
Only the changes made to src/core/Browser.js
Change-Id: I96f95e59a50fabea7dad1a8836e78aebac9112c8
diff --git a/loleaflet/src/core/Browser.js b/loleaflet/src/core/Browser.js
index 1a71e4a..fd9d7a8 100644
--- a/loleaflet/src/core/Browser.js
+++ b/loleaflet/src/core/Browser.js
@@ -1,5 +1,16 @@
/*
- * L.Browser handles different browser and feature detections for internal Leaflet use.
+ * @namespace Browser
+ * @aka L.Browser
+ *
+ * A namespace with static properties for browser/feature detection used by Leaflet internally.
+ *
+ * @example
+ *
+ * ```js
+ * if (L.Browser.ielt9) {
+ * alert('Upgrade your browser, dude!');
+ * }
+ * ```
*/
(function () {
@@ -13,44 +24,124 @@
phantomjs = ua.indexOf('phantom') !== -1,
android23 = ua.search('android [23]') !== -1,
chrome = ua.indexOf('chrome') !== -1,
+ gecko = ua.indexOf('gecko') !== -1 && !webkit && !window.opera && !ie,
- mobile = typeof orientation !== 'undefined',
- msPointer = navigator.msPointerEnabled && navigator.msMaxTouchPoints && !window.PointerEvent,
- pointer = (window.PointerEvent && navigator.pointerEnabled && navigator.maxTouchPoints) || msPointer,
+ win = navigator.platform.indexOf('Win') === 0,
+
+ mobile = typeof orientation !== 'undefined' || ua.indexOf('mobile') !== -1,
+ msPointer = !window.PointerEvent && window.MSPointerEvent,
+ pointer = window.PointerEvent || msPointer,
ie3d = ie && ('transition' in doc.style),
webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23,
gecko3d = 'MozPerspective' in doc.style,
- opera3d = 'OTransition' in doc.style;
+ opera12 = 'OTransition' in doc.style;
+
- var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
+ var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof window.DocumentTouch));
L.Browser = {
+
+ // @property ie: Boolean
+ // `true` for all Internet Explorer versions (not Edge).
ie: ie,
+
+ // @property ielt9: Boolean
+ // `true` for Internet Explorer versions less than 9.
ielt9: ie && !document.addEventListener,
+
+ // @property edge: Boolean
+ // `true` for the Edge web browser.
+ edge: 'msLaunchUri' in navigator && !('documentMode' in document),
+
+ // @property webkit: Boolean
+ // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
webkit: webkit,
- gecko: (ua.indexOf('gecko') !== -1) && !webkit && !window.opera && !ie,
+
+ // @property gecko: Boolean
+ // `true` for gecko-based browsers like Firefox.
+ gecko: gecko,
+
+ // @property android: Boolean
+ // `true` for any browser running on an Android platform.
android: ua.indexOf('android') !== -1,
+
+ // @property android23: Boolean
+ // `true` for browsers running on Android 2 or Android 3.
android23: android23,
+
+ // @property chrome: Boolean
+ // `true` for the Chrome browser.
chrome: chrome,
+
+ // @property safari: Boolean
+ // `true` for the Safari browser.
safari: !chrome && ua.indexOf('safari') !== -1,
+
+ // @property win: Boolean
+ // `true` when the browser is running in a Windows platform
+ win: win,
+
+
+ // @property ie3d: Boolean
+ // `true` for all Internet Explorer versions supporting CSS transforms.
ie3d: ie3d,
+
+ // @property webkit3d: Boolean
+ // `true` for webkit-based browsers supporting CSS transforms.
webkit3d: webkit3d,
+
+ // @property gecko3d: Boolean
+ // `true` for gecko-based browsers supporting CSS transforms.
gecko3d: gecko3d,
- opera3d: opera3d,
- any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs,
+ // @property opera12: Boolean
+ // `true` for the Opera browser supporting CSS transforms (version 12 or later).
+ opera12: opera12,
+
+ // @property any3d: Boolean
+ // `true` for all browsers supporting CSS transforms.
+ any3d: !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantomjs,
+
+
+ // @property mobile: Boolean
+ // `true` for all browsers running in a mobile device.
mobile: mobile,
+
+ // @property mobileWebkit: Boolean
+ // `true` for all webkit-based browsers in a mobile device.
mobileWebkit: mobile && webkit,
+
+ // @property mobileWebkit3d: Boolean
+ // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
mobileWebkit3d: mobile && webkit3d,
+
+ // @property mobileOpera: Boolean
+ // `true` for the Opera browser in a mobile device.
mobileOpera: mobile && window.opera,
+ // @property mobileGecko: Boolean
+ // `true` for gecko-based browsers running in a mobile device.
+ mobileGecko: mobile && gecko,
+
+
+ // @property touch: Boolean
+ // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
touch: !!touch,
+
+ // @property msPointer: Boolean
+ // `true` for browsers implementing the Microsoft touch events model (notably IE10).
msPointer: !!msPointer,
+
+ // @property pointer: Boolean
+ // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
pointer: !!pointer,
+
+ // @property retina: Boolean
+ // `true` for browsers on a high-resolution "retina" screen.
retina: (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1
};
commit 7ed38a20117210a4cca9ec23adbe1f4ab028aeec
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 18:16:46 2016 +0530
loleaflet: Pass print frame as argument to close function
Removing this._printIframe may still cause leakage here as
this._printIframe is overwritten everytime user issues a print
command.
Change-Id: I06f45604940380b809bc262f07b9b6a8aa7d9a87
diff --git a/loleaflet/src/map/handler/Map.Print.js b/loleaflet/src/map/handler/Map.Print.js
index 6ec4c2e..8f32fb6 100644
--- a/loleaflet/src/map/handler/Map.Print.js
+++ b/loleaflet/src/map/handler/Map.Print.js
@@ -50,11 +50,11 @@ L.Map.Print = L.Handler.extend({
this._printIframe.contentWindow.focus(); // Required for IE
this._printIframe.contentWindow.print();
// couldn't find another way to remove it
- setTimeout(L.bind(this._closePrintIframe, this), 300 * 1000);
+ setTimeout(L.bind(this._closePrintIframe, this, this._printIframe), 300 * 1000);
},
- _closePrintIframe: function () {
- L.DomUtil.remove(this._printIframe);
+ _closePrintIframe: function (printIframe) {
+ L.DomUtil.remove(printIframe);
this._map.focus();
}
});
commit e255fe64d22ebc1a1f8c015114b2684b27f9d1ca
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 18:14:52 2016 +0530
loleaflet: bump timeout for closing print iframe to 5 minutes
Change-Id: If58a28ef5c856b4ab5e497028fbcabf7b954b282
diff --git a/loleaflet/src/map/handler/Map.Print.js b/loleaflet/src/map/handler/Map.Print.js
index 5fa56c8..6ec4c2e 100644
--- a/loleaflet/src/map/handler/Map.Print.js
+++ b/loleaflet/src/map/handler/Map.Print.js
@@ -50,10 +50,10 @@ L.Map.Print = L.Handler.extend({
this._printIframe.contentWindow.focus(); // Required for IE
this._printIframe.contentWindow.print();
// couldn't find another way to remove it
- setTimeout(L.bind(this._closePrintDialog, this), 1000);
+ setTimeout(L.bind(this._closePrintIframe, this), 300 * 1000);
},
- _closePrintDialog: function () {
+ _closePrintIframe: function () {
L.DomUtil.remove(this._printIframe);
this._map.focus();
}
commit 9d039cbd5a65945b0fbb758f2841d725e4bd2a99
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 18:14:28 2016 +0530
Revert "loleaflet: print dialog: it seems that this magic hack is no more needed"
This reverts commit 8c522c44d101c0c5e3e1c51b59249266cef4e9d3.
We need to remove the iframe otherwise it will leak.
diff --git a/loleaflet/src/map/handler/Map.Print.js b/loleaflet/src/map/handler/Map.Print.js
index c2f8265..5fa56c8 100644
--- a/loleaflet/src/map/handler/Map.Print.js
+++ b/loleaflet/src/map/handler/Map.Print.js
@@ -49,6 +49,8 @@ L.Map.Print = L.Handler.extend({
_onIframeLoaded: function () {
this._printIframe.contentWindow.focus(); // Required for IE
this._printIframe.contentWindow.print();
+ // couldn't find another way to remove it
+ setTimeout(L.bind(this._closePrintDialog, this), 1000);
},
_closePrintDialog: function () {
commit 23ab2202594aca7fd10ade6b95a4c9e6df417fe4
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Dec 14 13:51:48 2016 +0530
Document owner termination feature
Change-Id: If9e09ba781e0cb53a6a96a6acdaac8995fa8f348
diff --git a/wsd/reference.txt b/wsd/reference.txt
index 33c2876..4e9f5b4 100644
--- a/wsd/reference.txt
+++ b/wsd/reference.txt
@@ -43,5 +43,9 @@ DisableExport
DisableCopy
Disables copy/paste from/to the document in libreoffice online backend
+EnableOwnerTermination
+ If set to true, it allows the document owner (the one with OwnerId =
+ UserId) to send a 'closedocument' message (see protocol.txt)
+
Note that it is possible to just hide print,save,export options while still
being able to access them from WOPI hosts using PostMessage API (see loleaflet/reference.html)
More information about the Libreoffice-commits
mailing list