mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #2560 from Half-Shot/msg-external-url
Add menu option for `external_url` if present
This commit is contained in:
commit
e66e8b11cb
@ -74,7 +74,7 @@ module.exports = React.createClass({
|
|||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
|
||||||
onPermalinkClick: function() {
|
closeMenu: function() {
|
||||||
if (this.props.onFinished) this.props.onFinished();
|
if (this.props.onFinished) this.props.onFinished();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ module.exports = React.createClass({
|
|||||||
var cancelButton;
|
var cancelButton;
|
||||||
var permalinkButton;
|
var permalinkButton;
|
||||||
var unhidePreviewButton;
|
var unhidePreviewButton;
|
||||||
|
var externalURLButton;
|
||||||
|
|
||||||
if (eventStatus === 'not_sent') {
|
if (eventStatus === 'not_sent') {
|
||||||
resendButton = (
|
resendButton = (
|
||||||
@ -146,7 +147,7 @@ module.exports = React.createClass({
|
|||||||
permalinkButton = (
|
permalinkButton = (
|
||||||
<div className="mx_MessageContextMenu_field">
|
<div className="mx_MessageContextMenu_field">
|
||||||
<a href={ "https://matrix.to/#/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() }
|
<a href={ "https://matrix.to/#/" + this.props.mxEvent.getRoomId() +"/"+ this.props.mxEvent.getId() }
|
||||||
target="_blank" onClick={ this.onPermalinkClick }>Permalink</a>
|
target="_blank" rel="noopener" onClick={ this.closeMenu }>Permalink</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -156,6 +157,17 @@ module.exports = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Bridges can provide a 'external_url' to link back to the source.
|
||||||
|
if( typeof(this.props.mxEvent.event.content.external_url) === "string") {
|
||||||
|
externalURLButton = (
|
||||||
|
<div className="mx_MessageContextMenu_field">
|
||||||
|
<a href={ this.props.mxEvent.event.content.external_url }
|
||||||
|
rel="noopener" target="_blank" onClick={ this.closeMenu }>Source URL</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{resendButton}
|
{resendButton}
|
||||||
@ -165,6 +177,7 @@ module.exports = React.createClass({
|
|||||||
{unhidePreviewButton}
|
{unhidePreviewButton}
|
||||||
{permalinkButton}
|
{permalinkButton}
|
||||||
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}
|
{UserSettingsStore.isFeatureEnabled('rich_text_editor') ? quoteButton : null}
|
||||||
|
{externalURLButton}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user