router: PropTypes.object,
};
- handleClick = () => {
+ handleClick = (event) => {
// if history is exhausted, or we would leave mastodon, just go to root.
if (window.history.state) {
- this.context.router.history.goBack();
+ const state = this.context.router.history.location.state;
+ if (event.shiftKey && state && state.mastodonBackSteps) {
+ this.context.router.history.go(-state.mastodonBackSteps);
+ } else {
+ this.context.router.history.goBack();
+ }
} else {
this.context.router.history.push('/');
}
router: PropTypes.object,
};
- handleClick = () => {
+ handleClick = (event) => {
// if history is exhausted, or we would leave mastodon, just go to root.
if (window.history.state) {
- this.context.router.history.goBack();
+ const state = this.context.router.history.location.state;
+ if (event.shiftKey && state && state.mastodonBackSteps) {
+ this.context.router.history.go(-state.mastodonBackSteps);
+ } else {
+ this.context.router.history.goBack();
+ }
} else {
this.context.router.history.push('/');
}
animatingNCD: false,
};
- historyBack = () => {
+ historyBack = (skip) => {
// if history is exhausted, or we would leave mastodon, just go to root.
if (window.history.state) {
- this.context.router.history.goBack();
+ const state = this.context.router.history.location.state;
+ if (skip && state && state.mastodonBackSteps) {
+ this.context.router.history.go(-state.mastodonBackSteps);
+ } else {
+ this.context.router.history.goBack();
+ }
} else {
this.context.router.history.push('/');
}
this.props.onMove(1);
}
- handleBackClick = () => {
- this.historyBack();
+ handleBackClick = (event) => {
+ this.historyBack(event.shiftKey);
}
handleTransitionEnd = () => {
if (this.context.router) {
e.preventDefault();
- this.context.router.history.push(this.props.to);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(this.props.to, state);
}
}
}
else if (e.shiftKey) {
this.setCollapsed(true);
document.getSelection().removeAllRanges();
- } else router.history.push(destination);
+ } else {
+ let state = {...router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ router.history.push(destination, state);
+ }
e.preventDefault();
}
}
if (this.context.router && e.button === 0) {
const id = e.currentTarget.getAttribute('data-id');
e.preventDefault();
- this.context.router.history.push(`/accounts/${id}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${id}`, state);
}
}
}
handleHotkeyOpen = () => {
- this.context.router.history.push(`/statuses/${this.props.status.get('id')}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/statuses/${this.props.status.get('id')}`, state);
}
handleHotkeyOpenProfile = () => {
- this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`, state);
}
handleHotkeyMoveUp = e => {
}
handleOpen = () => {
- this.context.router.history.push(`/statuses/${this.props.status.get('id')}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/statuses/${this.props.status.get('id')}`, state);
}
handleEmbed = () => {
handleAccountClick = e => {
if (e.button === 0) {
e.preventDefault();
- this.context.router.history.push(`/accounts/${this.props.to.get('id')}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.to.get('id')}`, state);
}
e.stopPropagation();
handleAccountClick = (e) => {
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
e.preventDefault();
- this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`, state);
}
e.stopPropagation();
parseClick = (e, destination) => {
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey) && this.context.router) {
e.preventDefault();
- this.context.router.history.push(destination);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(destination, state);
}
e.stopPropagation();
}
handleHotkeyOpenProfile = () => {
- this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`, state);
}
handleMoveUp = id => {
if (e.button === 0) {
e.preventDefault();
this.props.onClose();
- this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`, state);
}
}
if (e.button === 0) {
e.preventDefault();
this.props.onClose();
- this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
+ let state = {...this.context.router.history.location.state};
+ state.mastodonBackSteps = (state.mastodonBackSteps || 0) + 1;
+ this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`, state);
}
}