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(layout/note_actions): prevent layout shift by disabling button
Elian Doran04a641199bf6
diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsxindex ece48ee906..8e0a34cd09 100644--- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx+++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx@@ -151,14 +151,15 @@ function RefreshButton({ note, noteType, isDefaultViewMode, parentComponent, not}function SwitchSplitOrientationButton({ note, isReadOnly, isDefaultViewMode }: NoteActionsCustomInnerProps) {- const isEnabled = note.type === "mermaid" && note.isContentAvailable() && !isReadOnly && isDefaultViewMode;+ const isShown = note.type === "mermaid" && note.isContentAvailable() && isDefaultViewMode;const [ splitEditorOrientation, setSplitEditorOrientation ] = useTriliumOption("splitEditorOrientation");const upcomingOrientation = splitEditorOrientation === "horizontal" ? "vertical" : "horizontal";- return isEnabled && <ActionButton+ return isShown && <ActionButtontext={upcomingOrientation === "vertical" ? t("switch_layout_button.title_vertical") : t("switch_layout_button.title_horizontal")}icon={upcomingOrientation === "vertical" ? "bx bxs-dock-bottom" : "bx bxs-dock-left"}onClick={() => setSplitEditorOrientation(upcomingOrientation)}+ disabled={isReadOnly}/>;}diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.cssindex eafcc78793..1989295449 100644--- a/apps/client/src/widgets/ribbon/style.css+++ b/apps/client/src/widgets/ribbon/style.css@@ -451,6 +451,14 @@ body.experimental-feature-new-layout {margin: 0;gap: var(--button-gap);+ button {+ transition: opacity 250ms ease-in;++ &.disabled {+ opacity: 0.4;+ }+ }+.note-actions-custom {display: flex;align-items: center;