[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/debug loleaflet/reference.html loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Jan 14 13:29:07 PST 2016


 loleaflet/debug/document/document_simple_example.html |    1 
 loleaflet/reference.html                              |   21 ++++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js                 |    2 -
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 0ba142b80f001582482428f336c039f2dc3a0211
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Jan 14 22:26:11 2016 +0100

    loleaflet: Fire 'hyperlinkclicked' when the use clicks hyperlink in the doc.

diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index 1fe911e..f6d7d69 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -102,5 +102,6 @@
     globalMap.addControl(L.control.tabs());
     globalMap.addControl(L.control.columnHeader());
     globalMap.addControl(L.control.rowHeader());
+    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 9f755bb..dd76167 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -415,7 +415,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