Upgrade ESlint to v8 (#23305)
This commit is contained in:
@ -31,7 +31,7 @@ export default class ActionsModal extends ImmutablePureComponent {
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
return (
|
||||
|
@ -55,20 +55,20 @@ class BlockModal extends React.PureComponent {
|
||||
handleClick = () => {
|
||||
this.props.onClose();
|
||||
this.props.onConfirm(this.props.account);
|
||||
}
|
||||
};
|
||||
|
||||
handleSecondary = () => {
|
||||
this.props.onClose();
|
||||
this.props.onBlockAndReport(this.props.account);
|
||||
}
|
||||
};
|
||||
|
||||
handleCancel = () => {
|
||||
this.props.onClose();
|
||||
}
|
||||
};
|
||||
|
||||
setRef = (c) => {
|
||||
this.button = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { account } = this.props;
|
||||
|
@ -62,7 +62,7 @@ class BoostModal extends ImmutablePureComponent {
|
||||
handleReblog = () => {
|
||||
this.props.onReblog(this.props.status, this.props.privacy);
|
||||
this.props.onClose();
|
||||
}
|
||||
};
|
||||
|
||||
handleAccountClick = (e) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
@ -70,7 +70,7 @@ class BoostModal extends ImmutablePureComponent {
|
||||
this.props.onClose();
|
||||
this.context.router.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_findContainer = () => {
|
||||
return document.getElementsByClassName('modal-root__container')[0];
|
||||
@ -78,7 +78,7 @@ class BoostModal extends ImmutablePureComponent {
|
||||
|
||||
setRef = (c) => {
|
||||
this.button = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { status, privacy, intl } = this.props;
|
||||
|
@ -15,7 +15,7 @@ class Bundle extends React.PureComponent {
|
||||
onFetch: PropTypes.func,
|
||||
onFetchSuccess: PropTypes.func,
|
||||
onFetchFail: PropTypes.func,
|
||||
}
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
loading: emptyComponent,
|
||||
@ -24,14 +24,14 @@ class Bundle extends React.PureComponent {
|
||||
onFetch: noop,
|
||||
onFetchSuccess: noop,
|
||||
onFetchFail: noop,
|
||||
}
|
||||
};
|
||||
|
||||
static cache = new Map
|
||||
static cache = new Map;
|
||||
|
||||
state = {
|
||||
mod: undefined,
|
||||
forceRender: false,
|
||||
}
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
this.load(this.props);
|
||||
@ -83,7 +83,7 @@ class Bundle extends React.PureComponent {
|
||||
this.setState({ mod: null });
|
||||
onFetchFail(error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading: Loading, error: Error, children, renderDelay } = this.props;
|
||||
|
@ -31,7 +31,7 @@ class GIF extends React.PureComponent {
|
||||
if (!animate) {
|
||||
this.setState({ hovering: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseLeave = () => {
|
||||
const { animate } = this.props;
|
||||
@ -39,7 +39,7 @@ class GIF extends React.PureComponent {
|
||||
if (!animate) {
|
||||
this.setState({ hovering: false });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { src, staticSrc, className, animate } = this.props;
|
||||
@ -75,7 +75,7 @@ class CopyButton extends React.PureComponent {
|
||||
navigator.clipboard.writeText(value);
|
||||
this.setState({ copied: true });
|
||||
this.timeout = setTimeout(() => this.setState({ copied: false }), 700);
|
||||
}
|
||||
};
|
||||
|
||||
componentWillUnmount () {
|
||||
if (this.timeout) clearTimeout(this.timeout);
|
||||
@ -113,7 +113,7 @@ class BundleColumnError extends React.PureComponent {
|
||||
if (onRetry) {
|
||||
onRetry();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { errorType, multiColumn, stacktrace } = this.props;
|
||||
|
@ -16,11 +16,11 @@ class BundleModalError extends React.PureComponent {
|
||||
onRetry: PropTypes.func.isRequired,
|
||||
onClose: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
}
|
||||
};
|
||||
|
||||
handleRetry = () => {
|
||||
this.props.onRetry();
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { onClose, intl: { formatMessage } } = this.props;
|
||||
|
@ -23,7 +23,7 @@ export default class Column extends React.PureComponent {
|
||||
}
|
||||
|
||||
this._interruptScrollAnimation = scrollTop(scrollable);
|
||||
}
|
||||
};
|
||||
|
||||
scrollTop () {
|
||||
const scrollable = this.node.querySelector('.scrollable');
|
||||
@ -40,11 +40,11 @@ export default class Column extends React.PureComponent {
|
||||
if (typeof this._interruptScrollAnimation !== 'undefined') {
|
||||
this._interruptScrollAnimation();
|
||||
}
|
||||
}, 200)
|
||||
}, 200);
|
||||
|
||||
setRef = (c) => {
|
||||
this.node = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { heading, icon, children, active, hideHeadingOnMobile } = this.props;
|
||||
|
@ -15,7 +15,7 @@ export default class ColumnHeader extends React.PureComponent {
|
||||
|
||||
handleClick = () => {
|
||||
this.props.onClick();
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { icon, type, active, columnHeaderId } = this.props;
|
||||
|
@ -57,7 +57,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
|
||||
|
||||
state = {
|
||||
renderComposePanel: !(this.mediaQuery && this.mediaQuery.matches),
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.singleColumn) {
|
||||
@ -111,7 +111,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
|
||||
|
||||
handleLayoutChange = (e) => {
|
||||
this.setState({ renderComposePanel: !e.matches });
|
||||
}
|
||||
};
|
||||
|
||||
handleWheel = () => {
|
||||
if (typeof this._interruptScrollAnimation !== 'function') {
|
||||
@ -119,19 +119,19 @@ export default class ColumnsArea extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
this._interruptScrollAnimation();
|
||||
}
|
||||
};
|
||||
|
||||
setRef = (node) => {
|
||||
this.node = node;
|
||||
}
|
||||
};
|
||||
|
||||
renderLoading = columnId => () => {
|
||||
return columnId === 'COMPOSE' ? <DrawerLoading /> : <ColumnLoading multiColumn />;
|
||||
}
|
||||
};
|
||||
|
||||
renderError = (props) => {
|
||||
return <BundleColumnError multiColumn errorType='network' {...props} />;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { columns, children, singleColumn, isModalOpen } = this.props;
|
||||
|
@ -22,12 +22,12 @@ class ComposePanel extends React.PureComponent {
|
||||
onFocus = () => {
|
||||
const { dispatch } = this.props;
|
||||
dispatch(changeComposing(true));
|
||||
}
|
||||
};
|
||||
|
||||
onBlur = () => {
|
||||
const { dispatch } = this.props;
|
||||
dispatch(changeComposing(false));
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
const { dispatch } = this.props;
|
||||
|
@ -30,20 +30,20 @@ class ConfirmationModal extends React.PureComponent {
|
||||
this.props.onClose();
|
||||
}
|
||||
this.props.onConfirm();
|
||||
}
|
||||
};
|
||||
|
||||
handleSecondary = () => {
|
||||
this.props.onClose();
|
||||
this.props.onSecondary();
|
||||
}
|
||||
};
|
||||
|
||||
handleCancel = () => {
|
||||
this.props.onClose();
|
||||
}
|
||||
};
|
||||
|
||||
setRef = (c) => {
|
||||
this.button = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { message, confirm, secondary } = this.props;
|
||||
|
@ -46,7 +46,7 @@ class DisabledAccountBanner extends React.PureComponent {
|
||||
this.props.onLogout();
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { disabledAcct, movedToAcct } = this.props;
|
||||
|
@ -17,7 +17,7 @@ class EmbedModal extends ImmutablePureComponent {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
onError: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
}
|
||||
};
|
||||
|
||||
state = {
|
||||
loading: false,
|
||||
@ -48,11 +48,11 @@ class EmbedModal extends ImmutablePureComponent {
|
||||
|
||||
setIframeRef = c => {
|
||||
this.iframe = c;
|
||||
}
|
||||
};
|
||||
|
||||
handleTextareaClick = (e) => {
|
||||
e.target.select();
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { intl, onClose } = this.props;
|
||||
|
@ -135,7 +135,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||
|
||||
this.updatePosition(e);
|
||||
this.setState({ dragging: true });
|
||||
}
|
||||
};
|
||||
|
||||
handleTouchStart = e => {
|
||||
document.addEventListener('touchmove', this.handleMouseMove);
|
||||
@ -143,25 +143,25 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||
|
||||
this.updatePosition(e);
|
||||
this.setState({ dragging: true });
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseMove = e => {
|
||||
this.updatePosition(e);
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseUp = () => {
|
||||
document.removeEventListener('mousemove', this.handleMouseMove);
|
||||
document.removeEventListener('mouseup', this.handleMouseUp);
|
||||
|
||||
this.setState({ dragging: false });
|
||||
}
|
||||
};
|
||||
|
||||
handleTouchEnd = () => {
|
||||
document.removeEventListener('touchmove', this.handleMouseMove);
|
||||
document.removeEventListener('touchend', this.handleTouchEnd);
|
||||
|
||||
this.setState({ dragging: false });
|
||||
}
|
||||
};
|
||||
|
||||
updatePosition = e => {
|
||||
const { x, y } = getPointerPosition(this.node, e);
|
||||
@ -169,24 +169,24 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||
const focusY = (y - .5) * -2;
|
||||
|
||||
this.props.onChangeFocus(focusX, focusY);
|
||||
}
|
||||
};
|
||||
|
||||
handleChange = e => {
|
||||
this.props.onChangeDescription(e.target.value);
|
||||
}
|
||||
};
|
||||
|
||||
handleKeyDown = (e) => {
|
||||
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
|
||||
this.props.onChangeDescription(e.target.value);
|
||||
this.handleSubmit(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.props.onSave(this.props.description, this.props.focusX, this.props.focusY);
|
||||
}
|
||||
};
|
||||
|
||||
getCloseConfirmationMessage = () => {
|
||||
const { intl, dirty } = this.props;
|
||||
@ -199,15 +199,15 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setRef = c => {
|
||||
this.node = c;
|
||||
}
|
||||
};
|
||||
|
||||
handleTextDetection = () => {
|
||||
this._detectText();
|
||||
}
|
||||
};
|
||||
|
||||
_detectText = (refreshCache = false) => {
|
||||
const { media } = this.props;
|
||||
@ -258,21 +258,21 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||
console.error(e);
|
||||
this.setState({ detecting: false });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleThumbnailChange = e => {
|
||||
if (e.target.files.length > 0) {
|
||||
this.props.onSelectThumbnail(e.target.files);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setFileInputRef = c => {
|
||||
this.fileInput = c;
|
||||
}
|
||||
};
|
||||
|
||||
handleFileInputClick = () => {
|
||||
this.fileInput.click();
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
|
||||
|
@ -14,7 +14,7 @@ export default class ImageLoader extends PureComponent {
|
||||
height: PropTypes.number,
|
||||
onClick: PropTypes.func,
|
||||
zoomButtonHidden: PropTypes.bool,
|
||||
}
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
alt: '',
|
||||
@ -26,7 +26,7 @@ export default class ImageLoader extends PureComponent {
|
||||
loading: true,
|
||||
error: false,
|
||||
width: null,
|
||||
}
|
||||
};
|
||||
|
||||
removers = [];
|
||||
canvas = null;
|
||||
@ -86,7 +86,7 @@ export default class ImageLoader extends PureComponent {
|
||||
image.addEventListener('load', handleLoad);
|
||||
image.src = previewSrc;
|
||||
this.removers.push(removeEventListeners);
|
||||
})
|
||||
});
|
||||
|
||||
clearPreviewCanvas () {
|
||||
const { width, height } = this.canvas;
|
||||
@ -126,7 +126,7 @@ export default class ImageLoader extends PureComponent {
|
||||
setCanvasRef = c => {
|
||||
this.canvas = c;
|
||||
if (c) this.setState({ width: c.offsetWidth });
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { alt, src, width, height, onClick } = this.props;
|
||||
|
@ -44,7 +44,7 @@ class LinkFooter extends React.PureComponent {
|
||||
this.props.onLogout();
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { signedIn, permissions } = this.context.identity;
|
||||
|
@ -43,27 +43,27 @@ class MediaModal extends ImmutablePureComponent {
|
||||
|
||||
handleSwipe = (index) => {
|
||||
this.setState({ index: index % this.props.media.size });
|
||||
}
|
||||
};
|
||||
|
||||
handleTransitionEnd = () => {
|
||||
this.setState({
|
||||
zoomButtonHidden: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleNextClick = () => {
|
||||
this.setState({
|
||||
index: (this.getIndex() + 1) % this.props.media.size,
|
||||
zoomButtonHidden: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handlePrevClick = () => {
|
||||
this.setState({
|
||||
index: (this.props.media.size + this.getIndex() - 1) % this.props.media.size,
|
||||
zoomButtonHidden: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleChangeIndex = (e) => {
|
||||
const index = Number(e.currentTarget.getAttribute('data-index'));
|
||||
@ -72,7 +72,7 @@ class MediaModal extends ImmutablePureComponent {
|
||||
index: index % this.props.media.size,
|
||||
zoomButtonHidden: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleKeyDown = (e) => {
|
||||
switch(e.key) {
|
||||
@ -87,7 +87,7 @@ class MediaModal extends ImmutablePureComponent {
|
||||
e.stopPropagation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
window.addEventListener('keydown', this.handleKeyDown, false);
|
||||
|
@ -79,17 +79,17 @@ export default class ModalRoot extends React.PureComponent {
|
||||
|
||||
setBackgroundColor = color => {
|
||||
this.setState({ backgroundColor: color });
|
||||
}
|
||||
};
|
||||
|
||||
renderLoading = modalId => () => {
|
||||
return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
|
||||
}
|
||||
};
|
||||
|
||||
renderError = (props) => {
|
||||
const { onClose } = this.props;
|
||||
|
||||
return <BundleModalError {...props} onClose={onClose} />;
|
||||
}
|
||||
};
|
||||
|
||||
handleClose = (ignoreFocus = false) => {
|
||||
const { onClose } = this.props;
|
||||
@ -102,11 +102,11 @@ export default class ModalRoot extends React.PureComponent {
|
||||
// This would be much smoother with react-intl 3+ and `forwardRef`.
|
||||
}
|
||||
onClose(message, ignoreFocus);
|
||||
}
|
||||
};
|
||||
|
||||
setModalRef = (c) => {
|
||||
this._modal = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { type, props, ignoreFocus } = this.props;
|
||||
|
@ -65,23 +65,23 @@ class MuteModal extends React.PureComponent {
|
||||
handleClick = () => {
|
||||
this.props.onClose();
|
||||
this.props.onConfirm(this.props.account, this.props.notifications, this.props.muteDuration);
|
||||
}
|
||||
};
|
||||
|
||||
handleCancel = () => {
|
||||
this.props.onClose();
|
||||
}
|
||||
};
|
||||
|
||||
setRef = (c) => {
|
||||
this.button = c;
|
||||
}
|
||||
};
|
||||
|
||||
toggleNotifications = () => {
|
||||
this.props.onToggleNotifications();
|
||||
}
|
||||
};
|
||||
|
||||
changeMuteDuration = (e) => {
|
||||
this.props.onChangeMuteDuration(e);
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { account, notifications, muteDuration, intl } = this.props;
|
||||
|
@ -95,7 +95,7 @@ class ReportModal extends ImmutablePureComponent {
|
||||
} else {
|
||||
this.setState({ selectedRuleIds: selectedRuleIds.remove(ruleId) });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleChangeCategory = category => {
|
||||
this.setState({ category });
|
||||
|
@ -22,7 +22,7 @@ export default class UploadArea extends React.PureComponent {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
window.addEventListener('keyup', this.handleKeyUp, false);
|
||||
|
@ -102,7 +102,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
onClick: PropTypes.func,
|
||||
zoomButtonHidden: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
}
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
alt: '',
|
||||
@ -132,7 +132,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
dragged: false,
|
||||
lockScroll: { x: 0, y: 0 },
|
||||
lockTranslate: { x: 0, y: 0 },
|
||||
}
|
||||
};
|
||||
|
||||
removers = [];
|
||||
container = null;
|
||||
@ -212,7 +212,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
|
||||
// lock horizontal scroll
|
||||
this.container.scrollLeft = Math.max(this.container.scrollLeft + event.pixelX, this.state.lockScroll.x);
|
||||
}
|
||||
};
|
||||
|
||||
mouseDownHandler = e => {
|
||||
this.container.style.cursor = 'grabbing';
|
||||
@ -228,7 +228,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
|
||||
this.image.addEventListener('mousemove', this.mouseMoveHandler);
|
||||
this.image.addEventListener('mouseup', this.mouseUpHandler);
|
||||
}
|
||||
};
|
||||
|
||||
mouseMoveHandler = e => {
|
||||
const dx = e.clientX - this.state.dragPosition.x;
|
||||
@ -238,7 +238,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
this.container.scrollTop = Math.max(this.state.dragPosition.top - dy, this.state.lockScroll.y);
|
||||
|
||||
this.setState({ dragged: true });
|
||||
}
|
||||
};
|
||||
|
||||
mouseUpHandler = () => {
|
||||
this.container.style.cursor = 'grab';
|
||||
@ -246,13 +246,13 @@ class ZoomableImage extends React.PureComponent {
|
||||
|
||||
this.image.removeEventListener('mousemove', this.mouseMoveHandler);
|
||||
this.image.removeEventListener('mouseup', this.mouseUpHandler);
|
||||
}
|
||||
};
|
||||
|
||||
handleTouchStart = e => {
|
||||
if (e.touches.length !== 2) return;
|
||||
|
||||
this.lastDistance = getDistance(...e.touches);
|
||||
}
|
||||
};
|
||||
|
||||
handleTouchMove = e => {
|
||||
const { scrollTop, scrollHeight, clientHeight } = this.container;
|
||||
@ -275,7 +275,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
|
||||
this.lastMidpoint = midpoint;
|
||||
this.lastDistance = distance;
|
||||
}
|
||||
};
|
||||
|
||||
zoom(nextScale, midpoint) {
|
||||
const { scale, zoomMatrix } = this.state;
|
||||
@ -314,11 +314,11 @@ class ZoomableImage extends React.PureComponent {
|
||||
const handler = this.props.onClick;
|
||||
if (handler) handler();
|
||||
this.setState({ navigationHidden: !this.state.navigationHidden });
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseDown = e => {
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
initZoomMatrix = () => {
|
||||
const { width, height } = this.props;
|
||||
@ -350,7 +350,7 @@ class ZoomableImage extends React.PureComponent {
|
||||
translateY: translateY,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
handleZoomClick = e => {
|
||||
e.preventDefault();
|
||||
@ -392,15 +392,15 @@ class ZoomableImage extends React.PureComponent {
|
||||
|
||||
this.container.style.cursor = 'grab';
|
||||
this.container.style.removeProperty('user-select');
|
||||
}
|
||||
};
|
||||
|
||||
setContainerRef = c => {
|
||||
this.container = c;
|
||||
}
|
||||
};
|
||||
|
||||
setImageRef = c => {
|
||||
this.image = c;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { alt, src, width, height, intl } = this.props;
|
||||
|
@ -148,7 +148,7 @@ class SwitchingColumnsArea extends React.PureComponent {
|
||||
if (c) {
|
||||
this.node = c;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { children, mobile } = this.props;
|
||||
@ -270,16 +270,16 @@ class UI extends React.PureComponent {
|
||||
// but we set user-friendly message for other browsers, e.g. Edge.
|
||||
e.returnValue = intl.formatMessage(messages.beforeUnload);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleWindowFocus = () => {
|
||||
this.props.dispatch(focusApp());
|
||||
this.props.dispatch(submitMarkers({ immediate: true }));
|
||||
}
|
||||
};
|
||||
|
||||
handleWindowBlur = () => {
|
||||
this.props.dispatch(unfocusApp());
|
||||
}
|
||||
};
|
||||
|
||||
handleDragEnter = (e) => {
|
||||
e.preventDefault();
|
||||
@ -295,7 +295,7 @@ class UI extends React.PureComponent {
|
||||
if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore && this.context.identity.signedIn) {
|
||||
this.setState({ draggingOver: true });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleDragOver = (e) => {
|
||||
if (this.dataTransferIsText(e.dataTransfer)) return false;
|
||||
@ -310,7 +310,7 @@ class UI extends React.PureComponent {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
handleDrop = (e) => {
|
||||
if (this.dataTransferIsText(e.dataTransfer)) return;
|
||||
@ -323,7 +323,7 @@ class UI extends React.PureComponent {
|
||||
if (e.dataTransfer && e.dataTransfer.files.length >= 1 && this.props.canUploadMore && this.context.identity.signedIn) {
|
||||
this.props.dispatch(uploadCompose(e.dataTransfer.files));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleDragLeave = (e) => {
|
||||
e.preventDefault();
|
||||
@ -336,15 +336,15 @@ class UI extends React.PureComponent {
|
||||
}
|
||||
|
||||
this.setState({ draggingOver: false });
|
||||
}
|
||||
};
|
||||
|
||||
dataTransferIsText = (dataTransfer) => {
|
||||
return (dataTransfer && Array.from(dataTransfer.types).filter((type) => type === 'text/plain').length === 1);
|
||||
}
|
||||
};
|
||||
|
||||
closeUploadModal = () => {
|
||||
this.setState({ draggingOver: false });
|
||||
}
|
||||
};
|
||||
|
||||
handleServiceWorkerPostMessage = ({ data }) => {
|
||||
if (data.type === 'navigate') {
|
||||
@ -352,7 +352,7 @@ class UI extends React.PureComponent {
|
||||
} else {
|
||||
console.warn('Unknown message type:', data.type);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleLayoutChange = debounce(() => {
|
||||
this.props.dispatch(clearHeight()); // The cached heights are no longer accurate, invalidate
|
||||
@ -369,7 +369,7 @@ class UI extends React.PureComponent {
|
||||
} else {
|
||||
this.handleLayoutChange();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
const { signedIn } = this.context.identity;
|
||||
@ -423,7 +423,7 @@ class UI extends React.PureComponent {
|
||||
|
||||
setRef = c => {
|
||||
this.node = c;
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyNew = e => {
|
||||
e.preventDefault();
|
||||
@ -433,7 +433,7 @@ class UI extends React.PureComponent {
|
||||
if (element) {
|
||||
element.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeySearch = e => {
|
||||
e.preventDefault();
|
||||
@ -443,17 +443,17 @@ class UI extends React.PureComponent {
|
||||
if (element) {
|
||||
element.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyForceNew = e => {
|
||||
this.handleHotkeyNew(e);
|
||||
this.props.dispatch(resetCompose());
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyToggleComposeSpoilers = e => {
|
||||
e.preventDefault();
|
||||
this.props.dispatch(changeComposeSpoilerness());
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyFocusColumn = e => {
|
||||
const index = (e.key * 1) + 1; // First child is drawer, skip that
|
||||
@ -471,7 +471,7 @@ class UI extends React.PureComponent {
|
||||
status.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyBack = () => {
|
||||
if (window.history && window.history.length === 1) {
|
||||
@ -479,11 +479,11 @@ class UI extends React.PureComponent {
|
||||
} else {
|
||||
this.context.router.history.goBack();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setHotkeysRef = c => {
|
||||
this.hotkeys = c;
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyToggleHelp = () => {
|
||||
if (this.props.location.pathname === '/keyboard-shortcuts') {
|
||||
@ -491,55 +491,55 @@ class UI extends React.PureComponent {
|
||||
} else {
|
||||
this.context.router.history.push('/keyboard-shortcuts');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToHome = () => {
|
||||
this.context.router.history.push('/home');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToNotifications = () => {
|
||||
this.context.router.history.push('/notifications');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToLocal = () => {
|
||||
this.context.router.history.push('/public/local');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToFederated = () => {
|
||||
this.context.router.history.push('/public');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToDirect = () => {
|
||||
this.context.router.history.push('/conversations');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToStart = () => {
|
||||
this.context.router.history.push('/getting-started');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToFavourites = () => {
|
||||
this.context.router.history.push('/favourites');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToPinned = () => {
|
||||
this.context.router.history.push('/pinned');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToProfile = () => {
|
||||
this.context.router.history.push(`/@${this.props.username}`);
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToBlocked = () => {
|
||||
this.context.router.history.push('/blocks');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToMuted = () => {
|
||||
this.context.router.history.push('/mutes');
|
||||
}
|
||||
};
|
||||
|
||||
handleHotkeyGoToRequests = () => {
|
||||
this.context.router.history.push('/follow_requests');
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { draggingOver } = this.state;
|
||||
|
@ -80,17 +80,17 @@ export class WrappedRoute extends React.Component {
|
||||
{Component => <Component params={match.params} multiColumn={multiColumn} {...componentParams}>{content}</Component>}
|
||||
</BundleContainer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
renderLoading = () => {
|
||||
const { multiColumn } = this.props;
|
||||
|
||||
return <ColumnLoading multiColumn={multiColumn} />;
|
||||
}
|
||||
};
|
||||
|
||||
renderError = (props) => {
|
||||
return <BundleColumnError {...props} errorType='network' />;
|
||||
}
|
||||
};
|
||||
|
||||
render () {
|
||||
const { component: Component, content, ...rest } = this.props;
|
||||
|
@ -17,7 +17,7 @@ class ReducedMotion extends React.Component {
|
||||
defaultStyle: PropTypes.object,
|
||||
style: PropTypes.object,
|
||||
children: PropTypes.func,
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
|
Reference in New Issue
Block a user