Merge remote-tracking branch 'soapbox/develop' into events-

This commit is contained in:
marcin mikołajczak
2022-10-06 00:01:39 +02:00
23 changed files with 1748 additions and 1752 deletions

View File

@ -27,10 +27,8 @@ const ComposeModal: React.FC<IComposeModal> = ({ onClose }) => {
const { id: statusId, privacy, in_reply_to: inReplyTo, quote } = compose!;
const hasComposeContent = checkComposeContent(compose);
const onClickClose = () => {
if (hasComposeContent) {
if (checkComposeContent(compose)) {
dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/trash.svg'),
heading: statusId

View File

@ -1,31 +1,43 @@
// APIs for normalizing fullscreen operations. Note that Edge uses
// the WebKit-prefixed APIs currently (as of Edge 16).
export const isFullscreen = () => document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement;
export const isFullscreen = (): boolean => {
return Boolean(
document.fullscreenElement ||
// @ts-ignore
document.webkitFullscreenElement ||
// @ts-ignore
document.mozFullScreenElement,
);
};
export const exitFullscreen = () => {
export const exitFullscreen = (): void => {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
} else if ('webkitExitFullscreen' in document) {
// @ts-ignore
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
} else if ('mozCancelFullScreen' in document) {
// @ts-ignore
document.mozCancelFullScreen();
}
};
export const requestFullscreen = el => {
export const requestFullscreen = (el: Element): void => {
if (el.requestFullscreen) {
el.requestFullscreen();
} else if (el.webkitRequestFullscreen) {
} else if ('webkitRequestFullscreen' in el) {
// @ts-ignore
el.webkitRequestFullscreen();
} else if (el.mozRequestFullScreen) {
} else if ('mozRequestFullScreen' in el) {
// @ts-ignore
el.mozRequestFullScreen();
}
};
export const attachFullscreenListener = (listener) => {
type FullscreenListener = (this: Document, ev: Event) => void;
export const attachFullscreenListener = (listener: FullscreenListener): void => {
if ('onfullscreenchange' in document) {
document.addEventListener('fullscreenchange', listener);
} else if ('onwebkitfullscreenchange' in document) {
@ -35,7 +47,7 @@ export const attachFullscreenListener = (listener) => {
}
};
export const detachFullscreenListener = (listener) => {
export const detachFullscreenListener = (listener: FullscreenListener): void => {
if ('onfullscreenchange' in document) {
document.removeEventListener('fullscreenchange', listener);
} else if ('onwebkitfullscreenchange' in document) {