forked from matrix/element-web
support cancelling and uncancelling previews
This commit is contained in:
parent
a5258978d6
commit
ff2885087d
|
@ -66,6 +66,15 @@ module.exports = React.createClass({
|
||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onUnhidePreviewClick: function() {
|
||||||
|
if (global.localStorage) {
|
||||||
|
// 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());
|
||||||
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var eventStatus = this.props.mxEvent.status;
|
var eventStatus = this.props.mxEvent.status;
|
||||||
var resendButton;
|
var resendButton;
|
||||||
|
@ -73,6 +82,7 @@ module.exports = React.createClass({
|
||||||
var redactButton;
|
var redactButton;
|
||||||
var cancelButton;
|
var cancelButton;
|
||||||
var permalinkButton;
|
var permalinkButton;
|
||||||
|
var unhidePreviewButton;
|
||||||
|
|
||||||
if (eventStatus === 'not_sent') {
|
if (eventStatus === 'not_sent') {
|
||||||
resendButton = (
|
resendButton = (
|
||||||
|
@ -104,6 +114,18 @@ module.exports = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (global.localStorage) {
|
||||||
|
// FIXME: factor this out with LinkPreviewWidget
|
||||||
|
if (global.localStorage.getItem("hide_preview_" + this.props.mxEvent.getId()) === "1") {
|
||||||
|
unhidePreviewButton = (
|
||||||
|
<div className="mx_ContextualMenu_field" onClick={this.onUnhidePreviewClick}>
|
||||||
|
Unhide Preview
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: this should be https://matrix.to.
|
// XXX: this should be https://matrix.to.
|
||||||
// XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID)
|
// XXX: if we use room ID, we should also include a server where the event can be found (other than in the domain of the event ID)
|
||||||
permalinkButton = (
|
permalinkButton = (
|
||||||
|
@ -119,6 +141,7 @@ module.exports = React.createClass({
|
||||||
{redactButton}
|
{redactButton}
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
{viewSourceButton}
|
{viewSourceButton}
|
||||||
|
{unhidePreviewButton}
|
||||||
{permalinkButton}
|
{permalinkButton}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -33,6 +33,8 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_caption {
|
.mx_LinkPreviewWidget_caption {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
-webkit-flex: 1;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_title {
|
.mx_LinkPreviewWidget_title {
|
||||||
|
@ -48,3 +50,12 @@ limitations under the License.
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_LinkPreviewWidget_cancel {
|
||||||
|
visibility: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_LinkPreviewWidget:hover .mx_LinkPreviewWidget_cancel {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue