This commit is contained in:
the-djmaze 2022-03-22 11:47:17 +01:00
parent 40a0391092
commit 13f270f426
9 changed files with 75 additions and 90 deletions

View file

@ -12,7 +12,6 @@ import {
} from 'Common/EnumsUser';
import { pInt, isArray, arrayLength, forEachObjectEntry } from 'Common/Utils';
import { initFullscreen } from 'Common/UtilsUser';
import { encodeHtml, HtmlEditor, htmlToPlain } from 'Common/Html';
import { koArrayWithDestroy } from 'External/ko';
@ -21,7 +20,7 @@ import { messagesDeleteHelper } from 'Common/Folders';
import { serverRequest } from 'Common/Links';
import { i18n, getNotification, getUploadErrorDescByCode, timestampToString } from 'Common/Translator';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { doc, Settings, SettingsGet, getFullscreenElement, exitFullscreen, elementById, addShortcut } from 'Common/Globals';
import { Settings, SettingsGet, elementById, addShortcut/*, exitFullscreen, isFullscreen, toggleFullscreen*/ } from 'Common/Globals';
import { AppUserStore } from 'Stores/User/App';
import { SettingsUserStore } from 'Stores/User/Settings';
@ -45,9 +44,11 @@ import { AbstractViewPopup } from 'Knoin/AbstractViews';
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
import { AskPopupView } from 'View/Popup/Ask';
import { ContactsPopupView } from 'View/Popup/Contacts';
/*
import { ThemeStore } from 'Stores/Theme';
let alreadyFullscreen;
*/
const
ScopeCompose = 'Compose',
@ -766,7 +767,7 @@ export class ComposePopupView extends AbstractViewPopup {
this.to.focused(false);
(getFullscreenElement() === this.oContent) && exitFullscreen();
// alreadyFullscreen || exitFullscreen();
}
dropMailvelope() {
@ -856,8 +857,9 @@ export class ComposePopupView extends AbstractViewPopup {
this.initOnShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText);
}
// (navigator.standalone || matchMedia('(display-mode: standalone)').matches || matchMedia('(display-mode: fullscreen)').matches) &&
ThemeStore.isMobile() && this.oContent.requestFullscreen && this.oContent.requestFullscreen();
// Chrome bug #298
// alreadyFullscreen = isFullscreen();
// alreadyFullscreen || (ThemeStore.isMobile() && toggleFullscreen());
}
/**
@ -1350,15 +1352,6 @@ export class ComposePopupView extends AbstractViewPopup {
});
this.editor(editor => editor[this.isPlainEditor()?'modePlain':'modeWysiwyg']());
// Fullscreen must be on app, else other popups fail
const el = doc.getElementById('rl-app');
this.oContent = initFullscreen(el, () =>
ThemeStore.isMobile()
&& this.modalVisible()
&& (getFullscreenElement() !== el)
&& this.skipCommand()
);
}
/**

View file

@ -9,7 +9,8 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { doc, leftPanelDisabled, moveAction,
Settings, SettingsCapa, SettingsGet,
addEventsListeners,
addShortcut, registerShortcut, formFieldFocused
addShortcut, registerShortcut, formFieldFocused,
isFullscreen, toggleFullscreen
} from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody } from 'Common/UtilsUser';
@ -699,7 +700,7 @@ export class MailMessageList extends AbstractViewRight {
return false;
}
if (MessageUserStore.message() && this.useAutoSelect()) {
MessageUserStore.toggleFullScreen();
isFullscreen() || toggleFullscreen();
return false;
}
});

View file

@ -16,21 +16,19 @@ import {
import {
elementById,
$htmlCL,
leftPanelDisabled,
keyScopeReal,
moveAction,
Settings,
SettingsCapa,
getFullscreenElement,
exitFullscreen,
fireEvent,
addShortcut,
registerShortcut
registerShortcut,
isFullscreen, exitFullscreen, toggleFullscreen
} from 'Common/Globals';
import { arrayLength } from 'Common/Utils';
import { download, mailToHelper, showMessageComposer, initFullscreen } from 'Common/UtilsUser';
import { download, mailToHelper, showMessageComposer } from 'Common/UtilsUser';
import { SMAudio } from 'Common/Audio';
@ -120,8 +118,8 @@ export class MailMessageView extends AbstractViewRight {
this.messagesBodiesDom = MessageUserStore.bodiesDom;
this.messageError = MessageUserStore.error;
this.fullScreenMode = MessageUserStore.fullScreen;
this.toggleFullScreen = MessageUserStore.toggleFullScreen;
this.fullScreenMode = isFullscreen;
this.toggleFullScreen = toggleFullscreen;
this.messageListOfThreadsLoading = ko.observable(false).extend({ rateLimit: 1 });
this.highlightUnselectedAttachments = ko.observable(false).extend({ falseTimeout: 2000 });
@ -215,15 +213,6 @@ export class MailMessageView extends AbstractViewRight {
}
},
fullScreenMode: value => {
value && currentMessage() && AppUserStore.focusedState(Scope.MessageView);
if (this.oContent) {
value ? this.oContent.requestFullscreen() : exitFullscreen();
} else {
$htmlCL.toggle('rl-message-fullscreen', value);
}
},
showFullInfo: value => Local.set(ClientSideKeyNameMessageHeaderFullInfo, value ? '1' : '0')
});
@ -281,9 +270,6 @@ export class MailMessageView extends AbstractViewRight {
}
onBuild(dom) {
const el = dom.querySelector('.b-content');
this.oContent = initFullscreen(el, () => MessageUserStore.fullScreen(getFullscreenElement() === el));
const eqs = (ev, s) => ev.target.closestWithin(s, dom);
dom.addEventListener('click', event => {
ThemeStore.isMobile() && leftPanelDisabled(true);
@ -351,9 +337,8 @@ export class MailMessageView extends AbstractViewRight {
addShortcut('escape', '', Scope.MessageView, () => {
if (!this.viewModelDom.hidden && currentMessage()) {
const preview = SettingsUserStore.usePreviewPane();
if (MessageUserStore.fullScreen()) {
MessageUserStore.fullScreen(false);
if (isFullscreen()) {
exitFullscreen();
if (preview) {
AppUserStore.focusedState(Scope.MessageList);
}
@ -369,7 +354,7 @@ export class MailMessageView extends AbstractViewRight {
// fullscreen
addShortcut('enter,open', '', Scope.MessageView, () => {
MessageUserStore.toggleFullScreen();
isFullscreen() || toggleFullscreen();
return false;
});
@ -449,14 +434,14 @@ export class MailMessageView extends AbstractViewRight {
// change focused state
addShortcut('arrowleft', '', Scope.MessageView, () => {
if (!MessageUserStore.fullScreen() && currentMessage() && SettingsUserStore.usePreviewPane()
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()
&& !oMessageScrollerDom().scrollLeft) {
AppUserStore.focusedState(Scope.MessageList);
return false;
}
});
addShortcut('tab', 'shift', Scope.MessageView, () => {
if (!MessageUserStore.fullScreen() && currentMessage() && SettingsUserStore.usePreviewPane()) {
if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()) {
AppUserStore.focusedState(Scope.MessageList);
}
return false;

View file

@ -1,6 +1,5 @@
import { AppUserStore } from 'Stores/User/App';
import { AccountUserStore } from 'Stores/User/Account';
import { MessageUserStore } from 'Stores/User/Message';
//import { FolderUserStore } from 'Stores/User/Folder';
import { Scope } from 'Common/Enums';
@ -126,7 +125,7 @@ export class SystemDropDownUserView extends AbstractViewRight {
onBuild() {
registerShortcut('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
if (!this.viewModelDom.hidden) {
MessageUserStore.fullScreen(false);
// exitFullscreen();
this.accountMenuDropdownTrigger(true);
return false;
}