Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import { useEffect, useRef, useState } from "react";
export const useOverflowTitle = <T extends HTMLElement>(text: string) => {
const ref = useRef<T>(null);
const [isOverflowing, setIsOverflowing] = useState(false);
useEffect(() => {
const element = ref.current;
if (!element) return;
const checkOverflow = () => setIsOverflowing(element.scrollWidth > element.clientWidth);
checkOverflow();
if (typeof ResizeObserver === "undefined") return;
const observer = new ResizeObserver(checkOverflow);
observer.observe(element);
return () => observer.disconnect();
}, [text]);
return { ref, title: isOverflowing ? text : undefined };
};