Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

URL previewing support #260

Merged
merged 21 commits into from
Apr 11, 2016
Merged

URL previewing support #260

merged 21 commits into from
Apr 11, 2016

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Apr 3, 2016

  • Splits thumbnail height calculation for images into a new ImageUtils class so it can be used by both image event thumbnailing and URL preview thumbnailing
  • Adds a LinkPreviewWidget component for rendering URL previews, used within TextualBody
  • Update TextualBody to look for the links within its body, and create a URL preview of the first link it finds.
  • Support hiding and unhiding previews via mxEvent.widgetHidden (and persisted in localStorage as a short term soln)
  • Kill off the old onImageLoad callbacks on ScrollPanel and friends, and immediately resurrect them as onWidgetLoad callbacks to let ScrollPanel maintain its scroll offset correctly whilst URL previews are being dynamically loaded.

This is part of a set of PRs spanning vector-web, matrix-react-sdk, matrix-js-sdk and synapse.
See also element-hq/element-web#1343

'use strict';

module.exports = {
thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this is a public function, it would be nice to give this a comment saying what it does and what the parameters mean. How does its result relate to the thumbHeight param? Which of the params are allowed to be undefined? I could figure it out, but I shouldn't have to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@richvdh richvdh removed their assignment Apr 4, 2016
@ara4n
Copy link
Member Author

ara4n commented Apr 7, 2016

@richvdh PTAL - a few bits aren't resolved yet but are pending more feedback.

@ara4n ara4n assigned richvdh and unassigned ara4n Apr 7, 2016
@richvdh
Copy link
Member

richvdh commented Apr 8, 2016

So I think remaining things here are:

  • rewire the hiddenness flag/unhiding
  • forceupdate in MessagePanel._onWidgetLoad

@richvdh richvdh assigned ara4n and unassigned richvdh Apr 8, 2016
@ara4n
Copy link
Member Author

ara4n commented Apr 8, 2016

@richvdh done; feels much nicer to me. PTAL

@ara4n ara4n assigned richvdh and unassigned ara4n Apr 8, 2016
@@ -405,7 +405,7 @@ module.exports = React.createClass({
var scrollPanel = this.refs.scrollPanel;
if (scrollPanel) {
scrollPanel.checkScroll();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to do checkScroll as well as forceUpdate.

@ara4n
Copy link
Member Author

ara4n commented Apr 11, 2016

@richvdh PTAL again?

@richvdh
Copy link
Member

richvdh commented Apr 11, 2016

lgtm

@richvdh richvdh assigned ara4n and unassigned richvdh Apr 11, 2016
@ara4n ara4n merged commit f9c7ae1 into develop Apr 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants