sforkowany z mirror/soapbox
Merge branch 'shift-click-reblogs' into 'develop'
Quote posts: Shift+Click for normal repost See merge request soapbox-pub/soapbox-fe!1005improve-ci
commit
0e7f397841
|
@ -220,6 +220,7 @@ export default class Dropdown extends React.PureComponent {
|
|||
openDropdownId: PropTypes.number,
|
||||
openedViaKeyboard: PropTypes.bool,
|
||||
text: PropTypes.string,
|
||||
onShiftClick: PropTypes.func,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -230,14 +231,19 @@ export default class Dropdown extends React.PureComponent {
|
|||
id: id++,
|
||||
};
|
||||
|
||||
handleClick = ({ target, type }) => {
|
||||
if (this.state.id === this.props.openDropdownId) {
|
||||
handleClick = e => {
|
||||
const { onOpen, onShiftClick, openDropdownId } = this.props;
|
||||
|
||||
if (onShiftClick && e.shiftKey) {
|
||||
e.preventDefault();
|
||||
onShiftClick(e);
|
||||
} else if (this.state.id === openDropdownId) {
|
||||
this.handleClose();
|
||||
} else {
|
||||
const { top } = target.getBoundingClientRect();
|
||||
const { top } = e.target.getBoundingClientRect();
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -566,6 +566,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)}
|
||||
src={reblogIcon}
|
||||
direction='right'
|
||||
onShiftClick={this.handleReblogClick}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -523,6 +523,7 @@ class ActionBar extends React.PureComponent {
|
|||
src={reblogIcon}
|
||||
direction='right'
|
||||
text={intl.formatMessage(messages.reblog)}
|
||||
onShiftClick={this.handleReblogClick}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
|
|
Ładowanie…
Reference in New Issue