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 e1b0096bd1ac83e10735601f0bf2a70c0f3b0bac Author: merttumer <mert.tu...@collabora.com> AuthorDate: Tue Feb 19 20:30:52 2019 +0300 Commit: Mert Tümer <mert.tu...@collabora.com> CommitDate: Tue Feb 26 15:30:48 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.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/68028 diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index f85773d12..04fb0a972 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -1028,7 +1028,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 63c94a63e..014acbbe4 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits