mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Better solution for #298
This commit is contained in:
parent
1833388ea4
commit
91327a3c6c
6 changed files with 31 additions and 27 deletions
23
dev/Common/Fullscreen.js
Normal file
23
dev/Common/Fullscreen.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { doc, elementById, $htmlCL } from 'Common/Globals';
|
||||||
|
|
||||||
|
// Fullscreen must be on app, else other popups fail
|
||||||
|
export const
|
||||||
|
app = elementById('rl-app'),
|
||||||
|
appFullscreen = () => (doc.fullscreenElement || doc.webkitFullscreenElement) === app,
|
||||||
|
exitFullscreen = () => appFullscreen() && (doc.exitFullscreen || doc.webkitExitFullscreen).call(doc),
|
||||||
|
isFullscreen = ko.observable(false),
|
||||||
|
toggleFullscreen = () => isFullscreen() ? exitFullscreen() : app.requestFullscreen();
|
||||||
|
|
||||||
|
if (app) {
|
||||||
|
let event = 'fullscreenchange';
|
||||||
|
if (!app.requestFullscreen && app.webkitRequestFullscreen) {
|
||||||
|
app.requestFullscreen = app.webkitRequestFullscreen;
|
||||||
|
event = 'webkit'+event;
|
||||||
|
}
|
||||||
|
if (app.requestFullscreen) {
|
||||||
|
doc.addEventListener(event, () => {
|
||||||
|
isFullscreen(appFullscreen());
|
||||||
|
$htmlCL.toggle('rl-fullscreen', appFullscreen());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,13 +11,6 @@ export const
|
||||||
|
|
||||||
elementById = id => doc.getElementById(id),
|
elementById = id => doc.getElementById(id),
|
||||||
|
|
||||||
// Fullscreen must be on app, else other popups fail
|
|
||||||
app = doc.getElementById('rl-app'),
|
|
||||||
appFullscreen = () => (doc.fullscreenElement || doc.webkitFullscreenElement) === app,
|
|
||||||
exitFullscreen = () => appFullscreen() && (doc.exitFullscreen || doc.webkitExitFullscreen).call(doc),
|
|
||||||
isFullscreen = ko.observable(false),
|
|
||||||
toggleFullscreen = () => isFullscreen() ? exitFullscreen() : app.requestFullscreen(),
|
|
||||||
|
|
||||||
Settings = rl.settings,
|
Settings = rl.settings,
|
||||||
SettingsGet = Settings.get,
|
SettingsGet = Settings.get,
|
||||||
SettingsCapa = Settings.capa,
|
SettingsCapa = Settings.capa,
|
||||||
|
|
@ -65,20 +58,6 @@ export const
|
||||||
shortcuts.setScope(value);
|
shortcuts.setScope(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (app) {
|
|
||||||
let event = 'fullscreenchange';
|
|
||||||
if (!app.requestFullscreen && app.webkitRequestFullscreen) {
|
|
||||||
app.requestFullscreen = app.webkitRequestFullscreen;
|
|
||||||
event = 'webkit'+event;
|
|
||||||
}
|
|
||||||
if (app.requestFullscreen) {
|
|
||||||
doc.addEventListener(event, () => {
|
|
||||||
isFullscreen(appFullscreen());
|
|
||||||
$htmlCL.toggle('rl-fullscreen', appFullscreen());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdownVisibility.subscribe(value => {
|
dropdownVisibility.subscribe(value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
keyScope(ScopeMenu);
|
keyScope(ScopeMenu);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Scope } from 'Common/Enums';
|
import { Scope } from 'Common/Enums';
|
||||||
import { elementById, exitFullscreen } from 'Common/Globals';
|
import { elementById } from 'Common/Globals';
|
||||||
|
import { exitFullscreen } from 'Common/Fullscreen';
|
||||||
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { AppUserStore } from 'Stores/User/App';
|
import { AppUserStore } from 'Stores/User/App';
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ import { messagesDeleteHelper } from 'Common/Folders';
|
||||||
import { serverRequest } from 'Common/Links';
|
import { serverRequest } from 'Common/Links';
|
||||||
import { i18n, getNotification, getUploadErrorDescByCode, timestampToString } from 'Common/Translator';
|
import { i18n, getNotification, getUploadErrorDescByCode, timestampToString } from 'Common/Translator';
|
||||||
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
|
||||||
import { Settings, SettingsGet, elementById, addShortcut/*, exitFullscreen, isFullscreen, toggleFullscreen*/ } from 'Common/Globals';
|
import { Settings, SettingsGet, elementById, addShortcut } from 'Common/Globals';
|
||||||
|
//import { exitFullscreen, isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||||
|
|
||||||
import { AppUserStore } from 'Stores/User/App';
|
import { AppUserStore } from 'Stores/User/App';
|
||||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { doc, leftPanelDisabled, moveAction,
|
import { doc, leftPanelDisabled, moveAction,
|
||||||
Settings, SettingsCapa, SettingsGet,
|
Settings, SettingsCapa, SettingsGet,
|
||||||
addEventsListeners,
|
addEventsListeners,
|
||||||
addShortcut, registerShortcut, formFieldFocused,
|
addShortcut, registerShortcut, formFieldFocused
|
||||||
isFullscreen, toggleFullscreen
|
|
||||||
} from 'Common/Globals';
|
} from 'Common/Globals';
|
||||||
|
|
||||||
import { computedPaginatorHelper, showMessageComposer, populateMessageBody } from 'Common/UtilsUser';
|
import { computedPaginatorHelper, showMessageComposer, populateMessageBody } from 'Common/UtilsUser';
|
||||||
import { FileInfo } from 'Common/File';
|
import { FileInfo } from 'Common/File';
|
||||||
import { folderListOptionsBuilder, moveMessagesToFolder } from 'Common/Folders';
|
import { folderListOptionsBuilder, moveMessagesToFolder } from 'Common/Folders';
|
||||||
|
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||||
|
|
||||||
import { mailBox, serverRequest } from 'Common/Links';
|
import { mailBox, serverRequest } from 'Common/Links';
|
||||||
import { Selector } from 'Common/Selector';
|
import { Selector } from 'Common/Selector';
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ import {
|
||||||
SettingsCapa,
|
SettingsCapa,
|
||||||
fireEvent,
|
fireEvent,
|
||||||
addShortcut,
|
addShortcut,
|
||||||
registerShortcut,
|
registerShortcut
|
||||||
isFullscreen, exitFullscreen, toggleFullscreen
|
|
||||||
} from 'Common/Globals';
|
} from 'Common/Globals';
|
||||||
|
|
||||||
import { arrayLength } from 'Common/Utils';
|
import { arrayLength } from 'Common/Utils';
|
||||||
import { download, mailToHelper, showMessageComposer } from 'Common/UtilsUser';
|
import { download, mailToHelper, showMessageComposer } from 'Common/UtilsUser';
|
||||||
|
import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||||
|
|
||||||
import { SMAudio } from 'Common/Audio';
|
import { SMAudio } from 'Common/Audio';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue