Bugfix: exitFullscreen() errors

This commit is contained in:
djmaze 2021-09-01 11:01:13 +02:00
parent 671a7a7002
commit 47bbd3d410
3 changed files with 9 additions and 12 deletions

View file

@ -11,6 +11,9 @@ export const
elementById = id => doc.getElementById(id), elementById = id => doc.getElementById(id),
exitFullscreen = () => getFullscreenElement() && (doc.exitFullscreen || doc.webkitExitFullscreen)(),
getFullscreenElement = () => doc.fullscreenElement || doc.webkitFullscreenElement,
Settings = rl.settings, Settings = rl.settings,
SettingsGet = Settings.get, SettingsGet = Settings.get,

View file

@ -21,7 +21,7 @@ import { serverRequest } from 'Common/Links';
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator'; import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
import { timestampToString } from 'Common/Momentor'; import { timestampToString } from 'Common/Momentor';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache'; import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { doc, Settings, SettingsGet } from 'Common/Globals'; import { doc, Settings, SettingsGet, getFullscreenElement, exitFullscreen } from 'Common/Globals';
import { AppUserStore } from 'Stores/User/App'; import { AppUserStore } from 'Stores/User/App';
import { SettingsUserStore } from 'Stores/User/Settings'; import { SettingsUserStore } from 'Stores/User/Settings';
@ -643,7 +643,7 @@ class ComposePopupView extends AbstractViewPopup {
this.resizeObserver.disconnect(); this.resizeObserver.disconnect();
(doc.fullscreenElement || doc.webkitFullscreenElement) === this.oContent && doc.exitFullscreen(); (getFullscreenElement() === this.oContent) && exitFullscreen();
} }
editor(fOnInit) { editor(fOnInit) {
@ -1267,14 +1267,11 @@ class ComposePopupView extends AbstractViewPopup {
event = 'webkit' + event; event = 'webkit' + event;
} }
if (el.requestFullscreen) { if (el.requestFullscreen) {
if (!doc.exitFullscreen && doc.webkitExitFullscreen) {
doc.exitFullscreen = doc.webkitExitFullscreen;
}
this.oContent = el; this.oContent = el;
el.addEventListener(event, () => el.addEventListener(event, () =>
ThemeStore.isMobile() ThemeStore.isMobile()
&& this.modalVisibility() && this.modalVisibility()
&& (doc.fullscreenElement || doc.webkitFullscreenElement) !== el && (getFullscreenElement() !== el)
&& this.skipCommand() && this.skipCommand()
); );
} }

View file

@ -14,7 +14,7 @@ import {
MessageSetAction MessageSetAction
} from 'Common/EnumsUser'; } from 'Common/EnumsUser';
import { doc, $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings } from 'Common/Globals'; import { $htmlCL, leftPanelDisabled, keyScopeReal, moveAction, Settings, getFullscreenElement, exitFullscreen } from 'Common/Globals';
import { arrayLength, inFocus } from 'Common/Utils'; import { arrayLength, inFocus } from 'Common/Utils';
import { mailToHelper, showMessageComposer } from 'Common/UtilsUser'; import { mailToHelper, showMessageComposer } from 'Common/UtilsUser';
@ -242,7 +242,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
fullScreenMode: value => { fullScreenMode: value => {
if (this.oContent) { if (this.oContent) {
value ? this.oContent.requestFullscreen() : doc.exitFullscreen(); value ? this.oContent.requestFullscreen() : exitFullscreen();
} else { } else {
$htmlCL.toggle('rl-message-fullscreen', value); $htmlCL.toggle('rl-message-fullscreen', value);
} }
@ -332,12 +332,9 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
event = 'webkit'+event; event = 'webkit'+event;
} }
if (el.requestFullscreen) { if (el.requestFullscreen) {
if (!doc.exitFullscreen && doc.webkitExitFullscreen) {
doc.exitFullscreen = doc.webkitExitFullscreen;
}
this.oContent = el; this.oContent = el;
el.addEventListener(event, () => el.addEventListener(event, () =>
this.fullScreenMode((doc.fullscreenElement || doc.webkitFullscreenElement) === el) this.fullScreenMode(getFullscreenElement() === el)
); );
} }