add the concept of eventTileOps for managing widget visibility based on vdh's PR feedback
This commit is contained in:
parent
d107151f8a
commit
cdc89c0623
|
@ -27,6 +27,17 @@ var Resend = require("matrix-react-sdk/lib/Resend");
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'MessageContextMenu',
|
displayName: 'MessageContextMenu',
|
||||||
|
|
||||||
|
propTypes: {
|
||||||
|
/* the MatrixEvent associated with the context menu */
|
||||||
|
mxEvent: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
|
/* an optional EventTileOps implementation that can be used to unhide preview widgets */
|
||||||
|
eventTileOps: React.PropTypes.object,
|
||||||
|
|
||||||
|
/* callback called when the menu is dismissed */
|
||||||
|
onFinished: React.PropTypes.func,
|
||||||
|
},
|
||||||
|
|
||||||
onResendClick: function() {
|
onResendClick: function() {
|
||||||
Resend.resend(this.props.mxEvent);
|
Resend.resend(this.props.mxEvent);
|
||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
|
@ -69,10 +80,11 @@ module.exports = React.createClass({
|
||||||
onUnhidePreviewClick: function() {
|
onUnhidePreviewClick: function() {
|
||||||
if (global.localStorage) {
|
if (global.localStorage) {
|
||||||
// FIXME: factor this out with LinkPreviewWidget
|
// FIXME: factor this out with LinkPreviewWidget
|
||||||
// FIXME: somehow propagate this to the EventTile such that it updates itself and realises the link has rematerialised
|
|
||||||
global.localStorage.removeItem("hide_preview_" + this.props.mxEvent.getId());
|
global.localStorage.removeItem("hide_preview_" + this.props.mxEvent.getId());
|
||||||
}
|
}
|
||||||
this.props.mxEvent.widgetHidden = false;
|
if (this.props.eventTileOps) {
|
||||||
|
this.props.eventTileOps.unhideWidget();
|
||||||
|
}
|
||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue