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,
|
.floating-buttons-children,
|
||||||
.show-floating-buttons {
|
.show-floating-buttons {
|
||||||
position: absolute;
|
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);
|
inset-inline-end: var(--floating-buttons-horiz-offset, 10px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
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 "./style.css";
|
||||||
|
|
||||||
import { Indexed, numberObjectsInPlace } from "../../services/utils";
|
import { Indexed, numberObjectsInPlace } from "../../services/utils";
|
||||||
@ -42,6 +42,16 @@ export default function Ribbon() {
|
|||||||
refresh();
|
refresh();
|
||||||
}, [ note, noteType, isReadOnlyTemporarilyDisabled ]);
|
}, [ 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.
|
// Automatically activate the first ribbon tab that needs to be activated whenever a note changes.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!computedTabs) return;
|
if (!computedTabs) return;
|
||||||
@ -65,6 +75,7 @@ export default function Ribbon() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
ref={containerRef}
|
||||||
className={clsx("ribbon-container", noteContext?.viewScope?.viewMode !== "default" && "hidden-ext")}
|
className={clsx("ribbon-container", noteContext?.viewScope?.viewMode !== "default" && "hidden-ext")}
|
||||||
style={{ contain: "none" }}
|
style={{ contain: "none" }}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user