refactor: remove reliance on viewport height in favor of body (#1926)
This commit is contained in:
@@ -25,7 +25,7 @@ declare global {
|
|||||||
|
|
||||||
import { disableIosTextFieldZoom } from '@/Utils'
|
import { disableIosTextFieldZoom } from '@/Utils'
|
||||||
import { IsWebPlatform, WebAppVersion } from '@/Constants/Version'
|
import { IsWebPlatform, WebAppVersion } from '@/Constants/Version'
|
||||||
import { DesktopManagerInterface, Environment, SNLog } from '@standardnotes/snjs'
|
import { DesktopManagerInterface, SNLog } from '@standardnotes/snjs'
|
||||||
import ApplicationGroupView from './Components/ApplicationGroupView/ApplicationGroupView'
|
import ApplicationGroupView from './Components/ApplicationGroupView/ApplicationGroupView'
|
||||||
import { WebDevice } from './Application/Device/WebDevice'
|
import { WebDevice } from './Application/Device/WebDevice'
|
||||||
import { StartApplication } from './Application/Device/StartApplication'
|
import { StartApplication } from './Application/Device/StartApplication'
|
||||||
@@ -34,8 +34,6 @@ import { WebOrDesktopDevice } from './Application/Device/WebOrDesktopDevice'
|
|||||||
import { WebApplication } from './Application/Application'
|
import { WebApplication } from './Application/Application'
|
||||||
import { createRoot, Root } from 'react-dom/client'
|
import { createRoot, Root } from 'react-dom/client'
|
||||||
import { ElementIds } from './Constants/ElementIDs'
|
import { ElementIds } from './Constants/ElementIDs'
|
||||||
import { MediaQueryBreakpoints } from './Hooks/useMediaQuery'
|
|
||||||
import { setViewportHeightWithFallback } from './setViewportHeightWithFallback'
|
|
||||||
import { setDefaultMonospaceFont } from './setDefaultMonospaceFont'
|
import { setDefaultMonospaceFont } from './setDefaultMonospaceFont'
|
||||||
|
|
||||||
let keyCount = 0
|
let keyCount = 0
|
||||||
@@ -54,27 +52,7 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
SNLog.onError = console.error
|
SNLog.onError = console.error
|
||||||
let root: Root
|
let root: Root
|
||||||
|
|
||||||
const isDesktop =
|
|
||||||
device.environment === Environment.Desktop ||
|
|
||||||
(matchMedia(MediaQueryBreakpoints.md).matches && matchMedia(MediaQueryBreakpoints.pointerFine))
|
|
||||||
|
|
||||||
const setupViewportHeightListeners = () => {
|
|
||||||
if (!isDesktop) {
|
|
||||||
setViewportHeightWithFallback()
|
|
||||||
window.addEventListener('orientationchange', setViewportHeightWithFallback)
|
|
||||||
window.addEventListener('resize', setViewportHeightWithFallback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeViewportHeightListeners = () => {
|
|
||||||
if (!isDesktop) {
|
|
||||||
window.removeEventListener('orientationchange', setViewportHeightWithFallback)
|
|
||||||
window.removeEventListener('resize', setViewportHeightWithFallback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const onDestroy = () => {
|
const onDestroy = () => {
|
||||||
removeViewportHeightListeners()
|
|
||||||
const rootElement = document.getElementById(ElementIds.RootId) as HTMLElement
|
const rootElement = document.getElementById(ElementIds.RootId) as HTMLElement
|
||||||
root.unmount()
|
root.unmount()
|
||||||
rootElement.remove()
|
rootElement.remove()
|
||||||
@@ -84,13 +62,12 @@ const startApplication: StartApplication = async function startApplication(
|
|||||||
const renderApp = () => {
|
const renderApp = () => {
|
||||||
const rootElement = document.createElement('div')
|
const rootElement = document.createElement('div')
|
||||||
rootElement.id = ElementIds.RootId
|
rootElement.id = ElementIds.RootId
|
||||||
|
rootElement.className = 'h-full'
|
||||||
const appendedRootNode = document.body.appendChild(rootElement)
|
const appendedRootNode = document.body.appendChild(rootElement)
|
||||||
root = createRoot(appendedRootNode)
|
root = createRoot(appendedRootNode)
|
||||||
|
|
||||||
disableIosTextFieldZoom()
|
disableIosTextFieldZoom()
|
||||||
|
|
||||||
setupViewportHeightListeners()
|
|
||||||
|
|
||||||
setDefaultMonospaceFont(device.platform)
|
setDefaultMonospaceFont(device.platform)
|
||||||
|
|
||||||
root.render(
|
root.render(
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import {
|
|||||||
import { MobileWebReceiver, NativeMobileEventListener } from '../NativeMobileWeb/MobileWebReceiver'
|
import { MobileWebReceiver, NativeMobileEventListener } from '../NativeMobileWeb/MobileWebReceiver'
|
||||||
import { AndroidBackHandler } from '@/NativeMobileWeb/AndroidBackHandler'
|
import { AndroidBackHandler } from '@/NativeMobileWeb/AndroidBackHandler'
|
||||||
import { PrefDefaults } from '@/Constants/PrefDefaults'
|
import { PrefDefaults } from '@/Constants/PrefDefaults'
|
||||||
import { setCustomViewportHeight, setViewportHeightWithFallback } from '@/setViewportHeightWithFallback'
|
import { setCustomViewportHeight } from '@/setViewportHeightWithFallback'
|
||||||
import { WebServices } from './WebServices'
|
import { WebServices } from './WebServices'
|
||||||
|
|
||||||
export type WebEventObserver = (event: WebAppEvent, data?: unknown) => void
|
export type WebEventObserver = (event: WebAppEvent, data?: unknown) => void
|
||||||
@@ -258,7 +258,7 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
async handleMobileGainingFocusEvent(): Promise<void> {
|
async handleMobileGainingFocusEvent(): Promise<void> {
|
||||||
setViewportHeightWithFallback()
|
/** Optional override */
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInitialMobileScreenshotPrivacy(): void {
|
handleInitialMobileScreenshotPrivacy(): void {
|
||||||
@@ -285,8 +285,6 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
|||||||
if (this.protections.getMobileScreenshotPrivacyEnabled()) {
|
if (this.protections.getMobileScreenshotPrivacyEnabled()) {
|
||||||
this.mobileDevice().hideMobileInterfaceFromScreenshots()
|
this.mobileDevice().hideMobileInterfaceFromScreenshots()
|
||||||
}
|
}
|
||||||
|
|
||||||
setViewportHeightWithFallback()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMobileColorSchemeChangeEvent() {
|
handleMobileColorSchemeChangeEvent() {
|
||||||
@@ -294,7 +292,7 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMobileKeyboardWillChangeFrameEvent(frame: { height: number; contentHeight: number }): void {
|
handleMobileKeyboardWillChangeFrameEvent(frame: { height: number; contentHeight: number }): void {
|
||||||
setCustomViewportHeight(String(frame.contentHeight), 'px', true)
|
setCustomViewportHeight(frame.contentHeight, 'px', true)
|
||||||
this.notifyWebEvent(WebAppEvent.MobileKeyboardWillChangeFrame, frame)
|
this.notifyWebEvent(WebAppEvent.MobileKeyboardWillChangeFrame, frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,11 @@ class ApplicationGroupView extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id={this.state.activeApplication.identifier} key={this.state.activeApplication.ephemeralIdentifier}>
|
<div
|
||||||
|
id={this.state.activeApplication.identifier}
|
||||||
|
className={'h-full'}
|
||||||
|
key={this.state.activeApplication.ephemeralIdentifier}
|
||||||
|
>
|
||||||
<DeallocateHandler application={this.state.activeApplication}>
|
<DeallocateHandler application={this.state.activeApplication}>
|
||||||
<ApplicationView
|
<ApplicationView
|
||||||
key={this.state.activeApplication.ephemeralIdentifier}
|
key={this.state.activeApplication.ephemeralIdentifier}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ const ApplicationView: FunctionComponent<Props> = ({ application, mainApplicatio
|
|||||||
<DarkModeHandler application={application} />
|
<DarkModeHandler application={application} />
|
||||||
<ResponsivePaneProvider paneController={application.getViewControllerManager().paneController}>
|
<ResponsivePaneProvider paneController={application.getViewControllerManager().paneController}>
|
||||||
<PremiumModalProvider application={application} viewControllerManager={viewControllerManager}>
|
<PremiumModalProvider application={application} viewControllerManager={viewControllerManager}>
|
||||||
<div className={platformString + ' main-ui-view sn-component'}>
|
<div className={platformString + ' main-ui-view sn-component h-full'}>
|
||||||
<div id="app" className="app app-column-container" ref={appColumnContainerRef}>
|
<div id="app" className="app app-column-container" ref={appColumnContainerRef}>
|
||||||
<FileDragNDropProvider
|
<FileDragNDropProvider
|
||||||
application={application}
|
application={application}
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ const ContentListView: FunctionComponent<Props> = ({
|
|||||||
<div
|
<div
|
||||||
id="items-column"
|
id="items-column"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'sn-component section app-column flex h-screen flex-col overflow-hidden pt-safe-top md:h-full',
|
'sn-component section app-column flex h-full flex-col overflow-hidden pt-safe-top',
|
||||||
'xl:w-87.5 xsm-only:!w-full sm-only:!w-full',
|
'xl:w-87.5 xsm-only:!w-full sm-only:!w-full',
|
||||||
isTabletScreenSize && !isNotesListVisibleOnTablets
|
isTabletScreenSize && !isNotesListVisibleOnTablets
|
||||||
? 'pointer-coarse:md-only:!w-0 pointer-coarse:lg-only:!w-0'
|
? 'pointer-coarse:md-only:!w-0 pointer-coarse:lg-only:!w-0'
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const MultipleSelectedFiles = ({ filesController, selectionController }: Props)
|
|||||||
<FileOptionsPanel filesController={filesController} selectionController={selectionController} />
|
<FileOptionsPanel filesController={filesController} selectionController={selectionController} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex min-h-screen w-full max-w-md flex-grow flex-col items-center justify-center md:min-h-0">
|
<div className="flex min-h-full w-full max-w-md flex-grow flex-col items-center justify-center">
|
||||||
<IlNotesIcon className="block" />
|
<IlNotesIcon className="block" />
|
||||||
<h2 className="m-0 mt-4 text-center text-lg font-bold">{count} selected files</h2>
|
<h2 className="m-0 mt-4 text-center text-lg font-bold">{count} selected files</h2>
|
||||||
<p className="max-w-60 mt-2 text-center text-sm">Actions will be performed on all selected files.</p>
|
<p className="max-w-60 mt-2 text-center text-sm">Actions will be performed on all selected files.</p>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const MultipleSelectedNotes = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex min-h-screen w-full max-w-md flex-grow flex-col items-center justify-center md:min-h-0">
|
<div className="flex min-h-full w-full max-w-md flex-grow flex-col items-center justify-center md:min-h-0">
|
||||||
<IlNotesIcon className="block" />
|
<IlNotesIcon className="block" />
|
||||||
<h2 className="m-0 mt-4 text-center text-lg font-bold">{count} selected notes</h2>
|
<h2 className="m-0 mt-4 text-center text-lg font-bold">{count} selected notes</h2>
|
||||||
<p className="max-w-60 mt-2 text-center text-sm">Actions will be performed on all selected notes.</p>
|
<p className="max-w-60 mt-2 text-center text-sm">Actions will be performed on all selected notes.</p>
|
||||||
|
|||||||
@@ -98,10 +98,7 @@ class NoteGroupView extends AbstractComponent<Props, State> {
|
|||||||
const canRenderEditorView = this.state.selectedPane === AppPaneId.Editor || !this.state.isInMobileView
|
const canRenderEditorView = this.state.selectedPane === AppPaneId.Editor || !this.state.isInMobileView
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div id={ElementIds.EditorColumn} className="app-column app-column-third flex h-full flex-col pt-safe-top">
|
||||||
id={ElementIds.EditorColumn}
|
|
||||||
className="app-column app-column-third flex min-h-screen flex-col pt-safe-top md:h-full md:min-h-0"
|
|
||||||
>
|
|
||||||
<ResponsivePaneContent paneId={AppPaneId.Editor} className="flex-grow">
|
<ResponsivePaneContent paneId={AppPaneId.Editor} className="flex-grow">
|
||||||
{this.state.showMultipleSelectedNotes && (
|
{this.state.showMultipleSelectedNotes && (
|
||||||
<MultipleSelectedNotes
|
<MultipleSelectedNotes
|
||||||
|
|||||||
@@ -1025,11 +1025,7 @@ class NoteView extends AbstractComponent<NoteViewProps, State> {
|
|||||||
const renderHeaderOptions = isMobileScreen() ? !this.state.plaintextEditorFocused : true
|
const renderHeaderOptions = isMobileScreen() ? !this.state.plaintextEditorFocused : true
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div aria-label="Note" className="section editor sn-component h-full md:max-h-full" ref={this.noteViewElementRef}>
|
||||||
aria-label="Note"
|
|
||||||
className="section editor sn-component max-h-screen md:max-h-full"
|
|
||||||
ref={this.noteViewElementRef}
|
|
||||||
>
|
|
||||||
{this.note && (
|
{this.note && (
|
||||||
<NoteViewFileDropTarget
|
<NoteViewFileDropTarget
|
||||||
note={this.note}
|
note={this.note}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const PositionedPopoverContent = ({
|
|||||||
if (popoverElement) {
|
if (popoverElement) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
popoverElement.scrollTop = 0
|
popoverElement.scrollTop = 0
|
||||||
})
|
}, 10)
|
||||||
}
|
}
|
||||||
}, [popoverElement])
|
}, [popoverElement])
|
||||||
|
|
||||||
@@ -70,7 +70,8 @@ const PositionedPopoverContent = ({
|
|||||||
<Portal>
|
<Portal>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'absolute top-0 left-0 flex h-screen w-full min-w-80 cursor-auto flex-col overflow-y-auto rounded bg-default shadow-main md:h-auto md:max-w-xs',
|
'absolute top-0 left-0 flex h-full w-full min-w-80 cursor-auto flex-col',
|
||||||
|
'overflow-y-auto rounded bg-default shadow-main md:h-auto md:max-w-xs',
|
||||||
overrideZIndex ? overrideZIndex : 'z-dropdown-menu',
|
overrideZIndex ? overrideZIndex : 'z-dropdown-menu',
|
||||||
!isDesktopScreen ? 'pt-safe-top pb-safe-bottom' : '',
|
!isDesktopScreen ? 'pt-safe-top pb-safe-bottom' : '',
|
||||||
!styles && 'md:invisible',
|
!styles && 'md:invisible',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const PreferencesView: FunctionComponent<PreferencesProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'absolute top-0 left-0 z-preferences flex h-screen max-h-screen w-full flex-col bg-default pt-safe-top md:h-full md:max-h-full',
|
'absolute top-0 left-0 z-preferences flex h-full w-full flex-col bg-default pt-safe-top',
|
||||||
isIOS() ? 'pb-safe-bottom' : 'pb-2 md:pb-0',
|
isIOS() ? 'pb-safe-bottom' : 'pb-2 md:pb-0',
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { getPlatformString } from '@/Utils'
|
import { getPlatformString } from '@/Utils'
|
||||||
|
import { classNames } from '@/Utils/ConcatenateClassNames'
|
||||||
import { DialogOverlay, DialogContent } from '@reach/dialog'
|
import { DialogOverlay, DialogContent } from '@reach/dialog'
|
||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
|
|
||||||
@@ -16,7 +17,10 @@ const HistoryModalDialog = ({ children, onDismiss }: Props) => {
|
|||||||
>
|
>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
aria-label="Note revision history"
|
aria-label="Note revision history"
|
||||||
className="my-0 flex h-screen w-full flex-col rounded-md bg-[color:var(--modal-background-color)] p-0 pt-safe-top pb-safe-bottom shadow-lg md:max-h-[90%] md:w-[90%] md:max-w-[90%]"
|
className={classNames(
|
||||||
|
'my-0 flex h-full w-full flex-col rounded-md bg-[color:var(--modal-background-color)]',
|
||||||
|
'p-0 pt-safe-top pb-safe-bottom shadow-lg md:max-h-[90%] md:w-[90%] md:max-w-[90%]',
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex h-full flex-col overflow-hidden bg-default">{children}</div>
|
<div className="flex h-full flex-col overflow-hidden bg-default">{children}</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import ResponsivePaneContent from '@/Components/ResponsivePane/ResponsivePaneCon
|
|||||||
import { AppPaneId } from '@/Components/ResponsivePane/AppPaneMetadata'
|
import { AppPaneId } from '@/Components/ResponsivePane/AppPaneMetadata'
|
||||||
import { classNames } from '@/Utils/ConcatenateClassNames'
|
import { classNames } from '@/Utils/ConcatenateClassNames'
|
||||||
import { useResponsiveAppPane } from '../ResponsivePane/ResponsivePaneProvider'
|
import { useResponsiveAppPane } from '../ResponsivePane/ResponsivePaneProvider'
|
||||||
import { isIOS } from '@/Utils'
|
|
||||||
import UpgradeNow from '../Footer/UpgradeNow'
|
import UpgradeNow from '../Footer/UpgradeNow'
|
||||||
import RoundIconButton from '../Button/RoundIconButton'
|
import RoundIconButton from '../Button/RoundIconButton'
|
||||||
|
|
||||||
@@ -54,16 +53,70 @@ const Navigation: FunctionComponent<Props> = ({ application }) => {
|
|||||||
[application],
|
[application],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const NavigationFooter = useMemo(() => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'fixed bottom-0 flex min-h-[50px] w-full w-full items-center border-t border-border bg-contrast',
|
||||||
|
'px-3.5 pb-safe-bottom pt-2.5 md:hidden',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<RoundIconButton
|
||||||
|
className="mr-auto bg-default"
|
||||||
|
onClick={() => {
|
||||||
|
toggleAppPane(AppPaneId.Items)
|
||||||
|
}}
|
||||||
|
label="Go to items list"
|
||||||
|
icon="chevron-left"
|
||||||
|
/>
|
||||||
|
<UpgradeNow application={application} featuresController={viewControllerManager.featuresController} />
|
||||||
|
<RoundIconButton
|
||||||
|
className="ml-2.5 bg-default"
|
||||||
|
onClick={() => {
|
||||||
|
viewControllerManager.accountMenuController.toggleShow()
|
||||||
|
}}
|
||||||
|
label="Go to account menu"
|
||||||
|
icon="account-circle"
|
||||||
|
/>
|
||||||
|
{hasPasscode && (
|
||||||
|
<RoundIconButton
|
||||||
|
id="lock-item"
|
||||||
|
onClick={() => application.lock()}
|
||||||
|
label="Locks application and wipes unencrypted data from memory."
|
||||||
|
className="ml-2.5 bg-default"
|
||||||
|
icon="lock-filled"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<RoundIconButton
|
||||||
|
className="ml-2.5 bg-default"
|
||||||
|
onClick={() => {
|
||||||
|
viewControllerManager.preferencesController.openPreferences()
|
||||||
|
}}
|
||||||
|
label="Go to preferences"
|
||||||
|
icon="tune"
|
||||||
|
/>
|
||||||
|
<RoundIconButton
|
||||||
|
className="ml-2.5 bg-default"
|
||||||
|
onClick={() => {
|
||||||
|
viewControllerManager.quickSettingsMenuController.toggle()
|
||||||
|
}}
|
||||||
|
label="Go to quick settings menu"
|
||||||
|
icon="themes"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}, [hasPasscode, application, viewControllerManager, toggleAppPane])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
id="navigation"
|
id="navigation"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'sn-component section app-column h-screen max-h-screen overflow-hidden pt-safe-top md:h-full md:max-h-full md:min-h-0 md:pb-0',
|
'pb-[50px] md:pb-0',
|
||||||
|
'sn-component section app-column h-full max-h-full overflow-hidden pt-safe-top md:h-full md:max-h-full md:min-h-0',
|
||||||
'w-[220px] xl:w-[220px] xsm-only:!w-full sm-only:!w-full',
|
'w-[220px] xl:w-[220px] xsm-only:!w-full sm-only:!w-full',
|
||||||
selectedPane === AppPaneId.Navigation
|
selectedPane === AppPaneId.Navigation
|
||||||
? 'pointer-coarse:md-only:!w-48 pointer-coarse:lg-only:!w-48'
|
? 'pointer-coarse:md-only:!w-48 pointer-coarse:lg-only:!w-48'
|
||||||
: 'pointer-coarse:md-only:!w-0 pointer-coarse:lg-only:!w-0',
|
: 'pointer-coarse:md-only:!w-0 pointer-coarse:lg-only:!w-0',
|
||||||
isIOS() ? 'pb-safe-bottom' : 'pb-2.5',
|
|
||||||
)}
|
)}
|
||||||
ref={(element) => {
|
ref={(element) => {
|
||||||
if (element) {
|
if (element) {
|
||||||
@@ -88,50 +141,7 @@ const Navigation: FunctionComponent<Props> = ({ application }) => {
|
|||||||
<SmartViewsSection viewControllerManager={viewControllerManager} />
|
<SmartViewsSection viewControllerManager={viewControllerManager} />
|
||||||
<TagsSection viewControllerManager={viewControllerManager} />
|
<TagsSection viewControllerManager={viewControllerManager} />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center border-t border-border px-3.5 pt-2.5 md:hidden">
|
{NavigationFooter}
|
||||||
<RoundIconButton
|
|
||||||
className="mr-auto bg-default"
|
|
||||||
onClick={() => {
|
|
||||||
toggleAppPane(AppPaneId.Items)
|
|
||||||
}}
|
|
||||||
label="Go to items list"
|
|
||||||
icon="chevron-left"
|
|
||||||
/>
|
|
||||||
<UpgradeNow application={application} featuresController={viewControllerManager.featuresController} />
|
|
||||||
<RoundIconButton
|
|
||||||
className="ml-2.5 bg-default"
|
|
||||||
onClick={() => {
|
|
||||||
viewControllerManager.accountMenuController.toggleShow()
|
|
||||||
}}
|
|
||||||
label="Go to account menu"
|
|
||||||
icon="account-circle"
|
|
||||||
/>
|
|
||||||
{hasPasscode && (
|
|
||||||
<RoundIconButton
|
|
||||||
id="lock-item"
|
|
||||||
onClick={() => application.lock()}
|
|
||||||
label="Locks application and wipes unencrypted data from memory."
|
|
||||||
className="ml-2.5 bg-default"
|
|
||||||
icon="lock-filled"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<RoundIconButton
|
|
||||||
className="ml-2.5 bg-default"
|
|
||||||
onClick={() => {
|
|
||||||
viewControllerManager.preferencesController.openPreferences()
|
|
||||||
}}
|
|
||||||
label="Go to preferences"
|
|
||||||
icon="tune"
|
|
||||||
/>
|
|
||||||
<RoundIconButton
|
|
||||||
className="ml-2.5 bg-default"
|
|
||||||
onClick={() => {
|
|
||||||
viewControllerManager.quickSettingsMenuController.toggle()
|
|
||||||
}}
|
|
||||||
label="Go to quick settings menu"
|
|
||||||
icon="themes"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ResponsivePaneContent>
|
</ResponsivePaneContent>
|
||||||
{panelElement && (
|
{panelElement && (
|
||||||
<PanelResizer
|
<PanelResizer
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
import { log, LoggingDomain } from './Logging'
|
import { log, LoggingDomain } from './Logging'
|
||||||
|
|
||||||
export const ViewportHeightKey = '--viewport-height'
|
|
||||||
|
|
||||||
export const setViewportHeightWithFallback = () => {
|
|
||||||
const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight
|
|
||||||
|
|
||||||
if (!newValue) {
|
|
||||||
setCustomViewportHeight('100', 'vh')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setCustomViewportHeight(String(newValue), 'px')
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param forceTriggerResizeEvent On iPad at least, setProperty(ViewportHeightKey) does not trigger a resize event
|
* @param forceTriggerResizeEvent On iPad at least, setProperty(ViewportHeightKey) does not trigger a resize event
|
||||||
*/
|
*/
|
||||||
export const setCustomViewportHeight = (height: string, suffix: 'px' | 'vh', forceTriggerResizeEvent = false) => {
|
export const setCustomViewportHeight = (height: number, suffix: 'px' | 'vh', forceTriggerResizeEvent = false) => {
|
||||||
log(LoggingDomain.Viewport, `setCustomViewportHeight: ${height}`)
|
const value = `${height}${suffix}`
|
||||||
|
|
||||||
document.documentElement.style.setProperty(ViewportHeightKey, `${height}${suffix}`)
|
log(LoggingDomain.Viewport, `setCustomViewportHeight: ${value}`)
|
||||||
|
|
||||||
|
document.body.style.height = value
|
||||||
|
|
||||||
if (forceTriggerResizeEvent) {
|
if (forceTriggerResizeEvent) {
|
||||||
window.dispatchEvent(new Event('resize'))
|
window.dispatchEvent(new Event('resize'))
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ p {
|
|||||||
html,
|
html,
|
||||||
body,
|
body,
|
||||||
.main-ui-view {
|
.main-ui-view {
|
||||||
height: max-content;
|
height: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
max-height: none;
|
max-height: none;
|
||||||
|
|
||||||
@@ -139,8 +139,6 @@ body,
|
|||||||
background-color: var(--editor-header-bar-background-color);
|
background-color: var(--editor-header-bar-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
$footer-height: 2rem;
|
|
||||||
|
|
||||||
#resizer-overlay {
|
#resizer-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -157,10 +155,6 @@ $footer-height: 2rem;
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
|
||||||
height: calc(var(--viewport-height, 100vh) - #{$footer-height});
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: var(--z-index-modal);
|
z-index: var(--z-index-modal);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--viewport-height, 100vh);
|
height: 100vh;
|
||||||
|
|
||||||
padding-left: 1rem;
|
padding-left: 1rem;
|
||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
|
|||||||
@@ -53,17 +53,12 @@ module.exports = {
|
|||||||
89: '22.25rem',
|
89: '22.25rem',
|
||||||
125: '31.25rem',
|
125: '31.25rem',
|
||||||
},
|
},
|
||||||
height: {
|
|
||||||
screen: 'var(--viewport-height, 100vh)',
|
|
||||||
},
|
|
||||||
minHeight: {
|
minHeight: {
|
||||||
1: '0.25rem',
|
1: '0.25rem',
|
||||||
2: '0.5rem',
|
2: '0.5rem',
|
||||||
screen: 'var(--viewport-height, 100vh)',
|
|
||||||
},
|
},
|
||||||
maxHeight: {
|
maxHeight: {
|
||||||
110: '27.5rem',
|
110: '27.5rem',
|
||||||
screen: 'var(--viewport-height, 100vh)',
|
|
||||||
},
|
},
|
||||||
zIndex: {
|
zIndex: {
|
||||||
'editor-content': 'var(--z-index-editor-content)',
|
'editor-content': 'var(--z-index-editor-content)',
|
||||||
|
|||||||
Reference in New Issue
Block a user