When enabled, always display media in gallery. Also: click to reveal (#6692)
Fix #6677
This commit is contained in:
parent
77406d3a09
commit
b79ab15859
3 changed files with 45 additions and 8 deletions
|
@ -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 : ''}`}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue