From cad057ef348d7029c075644a9dd2a3d611e42788 Mon Sep 17 00:00:00 2001 From: Stefan Pearson Date: Thu, 14 Jul 2016 17:12:17 +0100 Subject: [PATCH] amends react template and removes opening image in lightbox --- .../views/rooms/LinkPreviewWidget.js | 46 +++++-------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/src/components/views/rooms/LinkPreviewWidget.js b/src/components/views/rooms/LinkPreviewWidget.js index ba438c1d12..3398b021fb 100644 --- a/src/components/views/rooms/LinkPreviewWidget.js +++ b/src/components/views/rooms/LinkPreviewWidget.js @@ -73,36 +73,13 @@ module.exports = React.createClass({ this.unmounted = true; }, - onImageClick: function(ev) { - var p = this.state.preview; - if (ev.button != 0 || ev.metaKey) return; - ev.preventDefault(); - var ImageView = sdk.getComponent("elements.ImageView"); - - var src = p["og:image"]; - if (src && src.startsWith("mxc://")) { - src = MatrixClientPeg.get().mxcUrlToHttp(src); - } - - var params = { - src: src, - width: p["og:image:width"], - height: p["og:image:height"], - name: p["og:title"] || p["og:description"] || this.props.link, - fileSize: p["matrix:image:size"], - link: this.props.link, - }; - - Modal.createDialog(ImageView, params, "mx_Dialog_lightbox"); - }, - render: function() { var p = this.state.preview; if (!p) return
; // FIXME: do we want to factor out all image displaying between this and MImageBody - especially for lightboxing? var image = p["og:image"]; - var imageMaxWidth = 100, imageMaxHeight = 100; + var imageMaxWidth = 600, imageMaxHeight = 400; if (image && image.startsWith("mxc://")) { image = MatrixClientPeg.get().mxcUrlToHttp(image, imageMaxWidth, imageMaxHeight); } @@ -114,23 +91,24 @@ module.exports = React.createClass({ var img; if (image) { - img =
- -
+ img = ( +
+ + + +
+ ); } return (
- { img }
{ p["og:title"] }
-
{ p["og:site_name"] ? (" - " + p["og:site_name"]) : null }
-
- { p["og:description"] } -
+
{ p["og:site_name"] ? ("from " + p["og:site_name"]) : null }
- + { img } +
{ p["og:description"] } Read more
+
); }