Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(note_icon): use bootstrap tooltip
Elian Doran73975ab52104
diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsxindex 7ce5e020f7..ae5867f458 100644--- a/apps/client/src/widgets/note_icon.tsx+++ b/apps/client/src/widgets/note_icon.tsx@@ -13,7 +13,7 @@ import ActionButton from "./react/ActionButton";import Dropdown from "./react/Dropdown";import { FormDropdownDivider, FormListItem } from "./react/FormList";import FormTextBox from "./react/FormTextBox";-import { useNoteContext, useNoteLabel } from "./react/hooks";+import { useNoteContext, useNoteLabel, useStaticTooltip } from "./react/hooks";interface IconToCountCache {iconClassToCountMap: Record<string, number>;@@ -58,9 +58,16 @@ function NoteIconList({ note, dropdownRef }: {dropdownRef: RefObject<BootstrapDropdown>;}) {const searchBoxRef = useRef<HTMLInputElement>(null);+ const iconListRef = useRef<HTMLDivElement>(null);const [ search, setSearch ] = useState<string>();const [ iconData, setIconData ] = useState<IconData>();const [ filterByPrefix, setFilterByPrefix ] = useState<string | null>(null);+ useStaticTooltip(iconListRef, {+ selector: "span",+ customClass: "pre-wrap-text",+ animation: false,+ title() { return this.getAttribute("title") || ""; },+ });useEffect(() => {async function loadIcons() {@@ -152,6 +159,7 @@ function NoteIconList({ note, dropdownRef }: {<divclass="icon-list"+ ref={iconListRef}onClick={(e) => {// Make sure we are not clicking on something else than a button.const clickedTarget = e.target as HTMLElement;