mirror of
https://github.com/zadam/trilium.git
synced 2026-02-28 17:43:36 +01:00
fix(mobile/text): floating toolbar mispositioned on iOS
This commit is contained in:
parent
e1de98c4ae
commit
8e8e6f9ed1
@ -68,8 +68,12 @@ export default function MobileEditorToolbar({ inPopupEditor }: MobileEditorToolb
|
||||
function usePositioningOniOS(enabled: boolean, wrapperRef: MutableRef<HTMLDivElement | null>) {
|
||||
const adjustPosition = useCallback(() => {
|
||||
if (!wrapperRef.current) return;
|
||||
const bottom = window.innerHeight - (window.visualViewport?.height || 0);
|
||||
wrapperRef.current.style.bottom = `${bottom}px`;
|
||||
const viewport = window.visualViewport;
|
||||
if (!viewport) return;
|
||||
// Account for both viewport height and its offset within the layout viewport,
|
||||
// which includes the Safari dynamic address bar height and any page scroll.
|
||||
const bottom = window.innerHeight - viewport.height - viewport.offsetTop;
|
||||
wrapperRef.current.style.bottom = `${Math.max(0, bottom)}px`;
|
||||
}, [ wrapperRef ]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user