fix: editor content being hidden under keyboard on mobile (#1410)

This commit is contained in:
Aman Harwara
2022-08-25 15:01:44 +05:30
committed by GitHub
parent c336f9de18
commit 520b3add0f
18 changed files with 124 additions and 72 deletions

View File

@@ -2,8 +2,6 @@ import { Platform, platformFromString } from '@standardnotes/snjs'
import { IsDesktopPlatform, IsWebPlatform } from '@/Constants/Version'
import { EMAIL_REGEX } from '../Constants/Constants'
export { isMobile } from './IsMobile'
declare const process: {
env: {
NODE_ENV: string | null | undefined
@@ -203,3 +201,14 @@ export const disableIosTextFieldZoom = () => {
addMaximumScaleToMetaViewport()
}
}
export const isMobileScreen = () => !window.matchMedia('(min-width: 768px)').matches
export const fitNodeToMobileScreen = (node: HTMLElement | null) => {
if (!node || !isMobileScreen()) {
return
}
node.style.height = `${visualViewport.height}px`
node.style.position = 'absolute'
node.style.top = `${document.documentElement.scrollTop}px`
}