Quote posts: Shift+Click for normal repost

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
improve-ci
marcin mikołajczak 2022-01-25 22:59:26 +01:00
rodzic d36f0f7aae
commit 8277d78f4c
3 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -220,6 +220,7 @@ export default class Dropdown extends React.PureComponent {
openDropdownId: PropTypes.number, openDropdownId: PropTypes.number,
openedViaKeyboard: PropTypes.bool, openedViaKeyboard: PropTypes.bool,
text: PropTypes.string, text: PropTypes.string,
onShiftClick: PropTypes.func,
}; };
static defaultProps = { static defaultProps = {
@ -230,14 +231,19 @@ export default class Dropdown extends React.PureComponent {
id: id++, id: id++,
}; };
handleClick = ({ target, type }) => { handleClick = e => {
if (this.state.id === this.props.openDropdownId) { const { onOpen, onShiftClick, openDropdownId } = this.props;
if (onShiftClick && e.shiftKey) {
e.preventDefault();
onShiftClick(e);
} else if (this.state.id === openDropdownId) {
this.handleClose(); this.handleClose();
} else { } else {
const { top } = target.getBoundingClientRect(); const { top } = e.target.getBoundingClientRect();
const placement = top * 2 < innerHeight ? 'bottom' : 'top'; const placement = top * 2 < innerHeight ? 'bottom' : 'top';
this.props.onOpen(this.state.id, this.handleItemClick, placement, type !== 'click'); onOpen(this.state.id, this.handleItemClick, placement, e.type !== 'click');
} }
} }

Wyświetl plik

@ -566,6 +566,7 @@ class StatusActionBar extends ImmutablePureComponent {
title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)}
src={reblogIcon} src={reblogIcon}
direction='right' direction='right'
onShiftClick={this.handleReblogClick}
/> />
); );
} else { } else {

Wyświetl plik

@ -523,6 +523,7 @@ class ActionBar extends React.PureComponent {
src={reblogIcon} src={reblogIcon}
direction='right' direction='right'
text={intl.formatMessage(messages.reblog)} text={intl.formatMessage(messages.reblog)}
onShiftClick={this.handleReblogClick}
/> />
); );
} else { } else {