From 7b94981b7d73626af6cdcab7ce694781b07b5e4a Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Mon, 13 Jan 2020 09:24:29 +0300 Subject: [PATCH] Show hyperlink pop-up on cell selection Change-Id: I59f3301bd94c4d898ec2ff82fd91d3c611122d3a Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86651 Tested-by: Jenkins CollaboraOffice Reviewed-by: Henry Castro --- loleaflet/src/layer/tile/TileLayer.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 8d31a7647..0d64ded2d 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -2843,6 +2843,29 @@ L.TileLayer = L.GridLayer.extend({ this._map.removeLayer(this._cellCursorMarker); } this._removeDropDownMarker(); + + //hyperlink pop-up from here + if (this._lastFormula && this._cellCursorMarker && this._lastFormula.substring(1, 10) == 'HYPERLINK') + { + var formula = this._lastFormula; + var targetURL = formula.substring(11, formula.length - 1).split(',')[0]; + targetURL = targetURL.split('"').join(''); + targetURL = this._map.makeURLFromStr(targetURL); + + this._map.closePopup(this._map.hyperlinkPopup); + this._map.hyperlinkPopup = null; + if (targetURL) { + this._map.hyperlinkPopup = new L.Popup({className: 'hyperlink-popup', closeButton: false, closeOnClick: false}) + .setContent('' + targetURL + '') + .setLatLng(this._cellCursorMarker._bounds._northEast) + .openOn(this._map); + } + + } + else if (this._map.hyperlinkPopup) + { + this._map.closePopup(this._map.hyperlinkPopup); + } }, _onValidityListButtonMsg: function(textMsg) {