loleaflet/src/dom/DomUtil.js | 8 ++++++++ loleaflet/src/map/Map.js | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+)
New commits: commit e660491383218cb753f9a2981d7668c1c2184c83 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Wed Oct 9 11:35:39 2019 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Wed Oct 9 17:42:59 2019 +0200 loeaflet: remove empty HTML elements The document type is detected when 'doclayerinit' event is fired. At that point we know the document type so we can remove safely the empty elements that they are useless to the document and of course a clean document to debug. I hope in the near future the server side can remove these unwanted elements, anyway how is useful an empty html element? Change-Id: I25f5b8cbcd176c4cc66abcb37b7d0d4b588d1d96 Reviewed-on: https://gerrit.libreoffice.org/80557 Reviewed-by: Henry Castro <hcas...@collabora.com> Tested-by: Henry Castro <hcas...@collabora.com> diff --git a/loleaflet/src/dom/DomUtil.js b/loleaflet/src/dom/DomUtil.js index 26a05a89e..91527ae63 100644 --- a/loleaflet/src/dom/DomUtil.js +++ b/loleaflet/src/dom/DomUtil.js @@ -79,6 +79,10 @@ L.DomUtil = { }, addClass: function (el, name) { + if (!el) { + return; + } + if (el.classList !== undefined) { var classes = L.Util.splitWords(name); for (var i = 0, len = classes.length; i < len; i++) { @@ -91,6 +95,10 @@ L.DomUtil = { }, removeClass: function (el, name) { + if (!el) { + return; + } + if (el.classList !== undefined) { el.classList.remove(name); } else { diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 0dfd40bc3..89c80ff98 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -199,6 +199,25 @@ L.Map = L.Evented.extend({ var interactiveRuler = this._permission === 'edit' ? true : false; L.control.ruler({position:'topleft', interactive:interactiveRuler}).addTo(this); } + var elem; + if (this._docLayer._docType === 'text') { + elem = L.DomUtil.get('spreadsheet-row-column-frame'); + elem.parentNode.removeChild(elem); + elem = L.DomUtil.get('spreadsheet-toolbar'); + elem.parentNode.removeChild(elem); + elem = L.DomUtil.get('presentation-controls-wrapper'); + elem.parentNode.removeChild(elem); + } + else if (this._docLayer._docType === 'presentation') { + elem = L.DomUtil.get('spreadsheet-row-column-frame'); + elem.parentNode.removeChild(elem); + elem = L.DomUtil.get('spreadsheet-toolbar'); + elem.parentNode.removeChild(elem); + } else if (this._docLayer._docType === 'spreadsheet') { + elem = L.DomUtil.get('presentation-controls-wrapper'); + elem.parentNode.removeChild(elem); + } + if (L.Browser.mobile) { this._socket.sendMessage('uno .uno:LOKSetMobile'); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits