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
chore(global_menu): dismiss menu when entering fullscreen
Elian Doran1c9f1ba82c0a
diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsxindex 39fcb88e84..73f1269133 100644--- a/apps/client/src/widgets/buttons/global_menu.tsx+++ b/apps/client/src/widgets/buttons/global_menu.tsx@@ -155,7 +155,7 @@ function ZoomControls({ parentComponent }: { parentComponent?: Component | nulluseEffect(updateZoomState, []);- function ZoomControlButton({ command, title, icon, children }: { command: KeyboardActionNames, title: string, icon?: string, children?: ComponentChildren }) {+ function ZoomControlButton({ command, title, icon, children, dismiss }: { command: KeyboardActionNames, title: string, icon?: string, children?: ComponentChildren, dismiss?: boolean }) {const linkRef = useRef<HTMLAnchorElement>(null);useStaticTooltipWithKeyboardShortcut(linkRef, title, command, {placement: "bottom",@@ -167,8 +167,10 @@ function ZoomControls({ parentComponent }: { parentComponent?: Component | nulltabIndex={0}onClick={(e) => {parentComponent?.triggerCommand(command);- setTimeout(() => updateZoomState(), 300)- e.stopPropagation();+ setTimeout(() => updateZoomState(), 300);+ if (!dismiss) {+ e.stopPropagation();+ }}}className={`dropdown-item-button ${icon}`}>{children}</a>@@ -184,7 +186,7 @@ function ZoomControls({ parentComponent }: { parentComponent?: Component | null{t("global_menu.zoom")}<><div className="zoom-buttons">- <ZoomControlButton command="toggleFullscreen" title={t("global_menu.toggle_fullscreen")} icon="bx bx-expand-alt" />+ <ZoomControlButton command="toggleFullscreen" title={t("global_menu.toggle_fullscreen")} icon="bx bx-expand-alt" dismiss /> <ZoomControlButton command="zoomOut" title={t("global_menu.zoom_out")} icon="bx bx-minus" /><ZoomControlButton command="zoomReset" title={t("global_menu.reset_zoom_level")}>{zoomLevel}{t("units.percentage")}</ZoomControlButton>