diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-08 08:57:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 08:57:21 +0100 |
commit | b79ab15859e7f8383526afd147e8416d2df2f7a7 (patch) | |
tree | e6c36733d86008899ac59eedc28a6d2ac511ee20 /app/javascript/mastodon/components/permalink.js | |
parent | 77406d3a092db48250a85984dde2f2cc81386146 (diff) |
When enabled, always display media in gallery. Also: click to reveal (#6692)
Fix #6677
Diffstat (limited to 'app/javascript/mastodon/components/permalink.js')
-rw-r--r-- | app/javascript/mastodon/components/permalink.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/javascript/mastodon/components/permalink.js b/app/javascript/mastodon/components/permalink.js index d726d37a2..b369e9812 100644 --- a/app/javascript/mastodon/components/permalink.js +++ b/app/javascript/mastodon/components/permalink.js @@ -12,9 +12,15 @@ export default class Permalink extends React.PureComponent { href: PropTypes.string.isRequired, to: PropTypes.string.isRequired, children: PropTypes.node, + onInterceptClick: PropTypes.func, }; - handleClick = (e) => { + handleClick = e => { + if (this.props.onInterceptClick && this.props.onInterceptClick()) { + e.preventDefault(); + return; + } + if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) { e.preventDefault(); this.context.router.history.push(this.props.to); @@ -22,7 +28,7 @@ export default class Permalink extends React.PureComponent { } render () { - const { href, children, className, ...other } = this.props; + const { href, children, className, onInterceptClick, ...other } = this.props; return ( <a target='_blank' href={href} onClick={this.handleClick} {...other} className={`permalink${className ? ' ' + className : ''}`}> |