mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 03:53:37 -06:00
fix(client/floating_buttons): clipped by ribbon
This commit is contained in:
parent
7fc3d413e5
commit
d5d2815bdf
@ -6,7 +6,7 @@
|
||||
.floating-buttons-children,
|
||||
.show-floating-buttons {
|
||||
position: absolute;
|
||||
top: var(--floating-buttons-vert-offset, 14px);
|
||||
top: calc(var(--floating-buttons-vert-offset, 14px) + var(--ribbon-height, 0));
|
||||
inset-inline-end: var(--floating-buttons-horiz-offset, 10px);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
||||
import { useNoteContext, useNoteProperty, useStaticTooltipWithKeyboardShortcut, useTriliumEvents } from "../react/hooks";
|
||||
import { useElementSize, useNoteContext, useNoteProperty, useStaticTooltipWithKeyboardShortcut, useTriliumEvents } from "../react/hooks";
|
||||
import "./style.css";
|
||||
|
||||
import { Indexed, numberObjectsInPlace } from "../../services/utils";
|
||||
@ -42,6 +42,16 @@ export default function Ribbon() {
|
||||
refresh();
|
||||
}, [ note, noteType, isReadOnlyTemporarilyDisabled ]);
|
||||
|
||||
// Manage height.
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const size = useElementSize(containerRef);
|
||||
useEffect(() => {
|
||||
if (!containerRef.current || !size) return;
|
||||
const parentEl = containerRef.current.closest<HTMLDivElement>(".note-split");
|
||||
if (!parentEl) return;
|
||||
parentEl.style.setProperty("--ribbon-height", `${size.height}px`);
|
||||
}, [ size ]);
|
||||
|
||||
// Automatically activate the first ribbon tab that needs to be activated whenever a note changes.
|
||||
useEffect(() => {
|
||||
if (!computedTabs) return;
|
||||
@ -65,6 +75,7 @@ export default function Ribbon() {
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={clsx("ribbon-container", noteContext?.viewScope?.viewMode !== "default" && "hidden-ext")}
|
||||
style={{ contain: "none" }}
|
||||
>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user