[Libreoffice-commits] online.git: loleaflet/js loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 27 15:26:14 UTC 2019
loleaflet/js/toolbar.js | 2 +-
loleaflet/src/control/Ruler.js | 24 +++++++++++++-----------
loleaflet/src/map/handler/Map.FileInserter.js | 8 ++++++--
3 files changed, 20 insertions(+), 14 deletions(-)
New commits:
commit ba8391af68ad0a206d94e23512c3daaf22a79a46
Author: merttumer <mert.tumer at collabora.com>
AuthorDate: Tue Feb 19 20:30:52 2019 +0300
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Feb 27 16:25:56 2019 +0100
Fix not able to insert image after new file from template
On Nextcloud, when creating a new document with template
in the first run, document does not load images or run saveAs
functions
Change-Id: I01611cbf66052cb80dece1d3ce06c238a23d2e2e
Signed-off-by: merttumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/68028
(cherry picked from commit e1b0096bd1ac83e10735601f0bf2a70c0f3b0bac)
Reviewed-on: https://gerrit.libreoffice.org/68449
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index fbe7c0905..730438f42 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1032,7 +1032,7 @@ function initNormalToolbar(toolItems) {
}
}
- if (event.target === 'styles' || event.target === 'fonts' || event.target === 'fontsizes') {
+ if ((event.target === 'styles' || event.target === 'fonts' || event.target === 'fontsizes') && event.item) {
var toolItem = $(this.box).find('#tb_'+ this.name +'_item_'+ w2utils.escapeId(event.item.id));
if ((_inDesktopMode() && event.item.desktop == false)
|| (_inTabletMode() && event.item.tablet == false)) {
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index 95ec5143b..a48dacb6f 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -39,19 +39,21 @@ L.Control.Ruler = L.Control.extend({
},
_changeInteractions: function(e) {
- if (e.perm === 'edit') {
- this._lMarginDrag.style.cursor = 'e-resize';
- this._rMarginDrag.style.cursor = 'w-resize';
+ if (this._lMarginDrag) {
+ if (e.perm === 'edit') {
+ this._lMarginDrag.style.cursor = 'e-resize';
+ this._rMarginDrag.style.cursor = 'w-resize';
- L.DomEvent.on(this._rMarginDrag, 'mousedown', this._initiateDrag, this);
- L.DomEvent.on(this._lMarginDrag, 'mousedown', this._initiateDrag, this);
- }
- else {
- this._lMarginDrag.style.cursor = 'default';
- this._rMarginDrag.style.cursor = 'default';
+ L.DomEvent.on(this._rMarginDrag, 'mousedown', this._initiateDrag, this);
+ L.DomEvent.on(this._lMarginDrag, 'mousedown', this._initiateDrag, this);
+ }
+ else {
+ this._lMarginDrag.style.cursor = 'default';
+ this._rMarginDrag.style.cursor = 'default';
- L.DomEvent.off(this._rMarginDrag, 'mousedown', this._initiateDrag, this);
- L.DomEvent.off(this._lMarginDrag, 'mousedown', this._initiateDrag, this);
+ L.DomEvent.off(this._rMarginDrag, 'mousedown', this._initiateDrag, this);
+ L.DomEvent.off(this._lMarginDrag, 'mousedown', this._initiateDrag, this);
+ }
}
},
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index 91a51e786..a2047d41b 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -18,11 +18,14 @@ L.Map.FileInserter = L.Handler.extend({
this._toInsertURL = {};
var parser = document.createElement('a');
parser.href = map.options.server;
+ },
+
+ getWopiUrl: function (map) {
var wopiSrc = '';
if (map.options.wopiSrc != '') {
wopiSrc = '?WOPISrc=' + map.options.wopiSrc;
}
- this._url = map.options.webserver + map.options.serviceRoot + '/' + map.options.urlPrefix +
+ return map.options.webserver + map.options.serviceRoot + '/' + map.options.urlPrefix +
'/' + encodeURIComponent(map.options.doc) + '/insertfile' + wopiSrc;
},
@@ -72,9 +75,10 @@ L.Map.FileInserter = L.Handler.extend({
},
_sendFile: function (name, file) {
- var url = this._url;
var socket = this._map._socket;
var map = this._map;
+ var url = this.getWopiUrl(map);
+
if (window.ThisIsAMobileApp) {
// Pass the file contents as a base64-encoded parameter in an insertfile message
var reader = new FileReader();
More information about the Libreoffice-commits
mailing list