mirror of https://github.com/vector-im/riot-web
implement view source for edits
parent
f4a8314c4f
commit
70334b69ec
|
@ -59,6 +59,15 @@ export default class EditHistoryMessage extends React.PureComponent {
|
||||||
}, 'mx_Dialog_confirmredact');
|
}, 'mx_Dialog_confirmredact');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_onViewSourceClick = () => {
|
||||||
|
const ViewSource = sdk.getComponent('structures.ViewSource');
|
||||||
|
Modal.createTrackedDialog('View Event Source', '', ViewSource, {
|
||||||
|
roomId: this.props.mxEvent.getRoomId(),
|
||||||
|
eventId: this.props.mxEvent.getId(),
|
||||||
|
content: this.props.mxEvent.event,
|
||||||
|
}, 'mx_Dialog_viewsource');
|
||||||
|
};
|
||||||
|
|
||||||
pillifyLinks() {
|
pillifyLinks() {
|
||||||
// not present for redacted events
|
// not present for redacted events
|
||||||
if (this.refs.content) {
|
if (this.refs.content) {
|
||||||
|
@ -84,12 +93,19 @@ export default class EditHistoryMessage extends React.PureComponent {
|
||||||
_renderActionBar() {
|
_renderActionBar() {
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
// hide the button when already redacted
|
// hide the button when already redacted
|
||||||
if (this.props.mxEvent.isRedacted()) {
|
let redactButton;
|
||||||
return null;
|
if (!this.props.mxEvent.isRedacted()) {
|
||||||
|
redactButton = (<AccessibleButton onClick={this._onRedactClick} disabled={!this.state.canRedact}>
|
||||||
|
{_t("Remove")}
|
||||||
|
</AccessibleButton>);
|
||||||
}
|
}
|
||||||
|
const viewSourceButton = (<AccessibleButton onClick={this._onViewSourceClick}>
|
||||||
|
{_t("View Source")}
|
||||||
|
</AccessibleButton>);
|
||||||
// disabled remove button when not allowed
|
// disabled remove button when not allowed
|
||||||
return (<div className="mx_MessageActionBar">
|
return (<div className="mx_MessageActionBar">
|
||||||
<AccessibleButton onClick={this._onRedactClick} disabled={!this.state.canRedact}>{_t("Remove")}</AccessibleButton>
|
{redactButton}
|
||||||
|
{viewSourceButton}
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue