[Libreoffice-commits] online.git: loleaflet/debug loleaflet/reference.html loleaflet/src
Jan Holesovsky
kendy at collabora.com
Thu Jan 14 13:32:56 PST 2016
loleaflet/debug/document/document_simple_example.html | 2 +
loleaflet/reference.html | 21 ++++++++++++++++++
loleaflet/src/layer/tile/TileLayer.js | 2 -
3 files changed, 24 insertions(+), 1 deletion(-)
New commits:
commit 95bc0d4ebbb1bd88cc55c8e0c10afe74d0e25a87
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Jan 14 22:26:11 2016 +0100
loleaflet: Fire 'hyperlinkclicked' when the user clicks hyperlink in the doc.
diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index f3c8452..e336b60 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -104,5 +104,7 @@
globalMap.addControl(L.control.rowHeader());
globalMap.addControl(L.control.presentation());
+ // handle the click on a hyperlink in the document
+ globalMap.on('hyperlinkclicked', function (e) { window.open(e.url, '_blank'); });
</script>
</body></html>
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 7ac486e..1fb2953 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -1889,6 +1889,11 @@ unexpected behaviour.</h4>
<td>Fired on server or client error.</td>
</tr>
<tr>
+ <td><code><b>hyperlinkclicked</b></code></td>
+ <td><code><a href="#hyperlinkclicked-event">HyperlinkClickedEvent</a></code></td>
+ <td>Fired when the user clicks a hyperlink in the document.</td>
+ </tr>
+ <tr>
<td><code><b>invalidatepreview</b></code></td>
<td><code><a href="#invalidatepreview-event">InvalidatePreviewEvent</a></code></td>
<td>Fired when a preview needs to be invalidated.</td>
@@ -2094,6 +2099,22 @@ The <code>id</code> property of ErrorEvent can have the following values:
</tr>
</table>
+<h3 id="hyperlinkclicked-event">HyperlinkClickedEvent</h3>
+
+<table data-id='events'>
+ <tr>
+ <th class="width100">property</th>
+ <th>type</th>
+ <th>description</th>
+ </tr>
+ <tr>
+ <td><code><b>url</b></code></td>
+ <td><code>String</code></td>
+ <td>Target URL of the hyperlink that the user clicked in the
+ document.</td>
+ </tr>
+</table>
+
<h3 id="invalidatepreview-event">InvalidatePreviewEvent</h3>
<p>LOLeaflet specific events.</p>
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 4a2f2b8..029e6f4 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -414,7 +414,7 @@ L.TileLayer = L.GridLayer.extend({
_onHyperlinkClickedMsg: function (textMsg) {
var link = textMsg.substring(18);
- window.open(link, '_blank');
+ this._map.fire('hyperlinkclicked', {url: link});
},
_onInvalidateCursorMsg: function (textMsg) {
More information about the Libreoffice-commits
mailing list