Skip to content

Build your personal knowledge base with Trilium Notes

client/tab width switcher: fix visibility when changing the current note type

Adorian Doran6e4a96613ad6
diff --git a/apps/client/src/widgets/layout/StatusBar.tsx b/apps/client/src/widgets/layout/StatusBar.tsx
index aaf3c7a2fb..9659eb4ca6 100644
--- a/apps/client/src/widgets/layout/StatusBar.tsx
+++ b/apps/client/src/widgets/layout/StatusBar.tsx
@@ -163,12 +163,13 @@ function StatusBarButton({ className, icon, text, title, active, ...restProps }:
//#region Language Switcher
function LanguageSwitcher({ note }: StatusBarContext) {
const [ modalShown, setModalShown ] = useState(false);
+ const noteType = useNoteProperty(note, "type");
const { locales, DEFAULT_LOCALE, currentNoteLanguage, setCurrentNoteLanguage } = useLanguageSwitcher(note);
const { activeLocale, processedLocales } = useProcessedLocales(locales, DEFAULT_LOCALE, currentNoteLanguage ?? DEFAULT_LOCALE.id);
return (
<>
- {note.type === "text" && <StatusBarDropdown
+ {noteType === "text" && <StatusBarDropdown
icon="bx bx-globe"
title={t("status_bar.language_title")}
text={<span dir={activeLocale?.rtl ? "rtl" : "ltr"}>{getLocaleName(activeLocale)}</span>}
@@ -458,6 +459,7 @@ function NotePaths({ note, hoistedNoteId, notePath }: StatusBarContext) {
const TAB_WIDTH_OPTIONS = [1, 2, 3, 4, 6, 8] as const;
function TabWidthSwitcher({ note, noteContext }: StatusBarContext) {
+ const noteType = useNoteProperty(note, "type");
const [ globalTabWidth ] = useTriliumOptionInt("codeNoteTabWidth");
const [ globalUseTabs ] = useTriliumOptionBool("codeNoteIndentWithTabs");
const [ noteTabWidth, setNoteTabWidth ] = useNoteLabelInt(note, "tabWidth");
@@ -486,7 +488,7 @@ function TabWidthSwitcher({ note, noteContext }: StatusBarContext) {
? t("status_bar.tab_width_tabs", { width: effectiveTabWidth })
: t("status_bar.tab_width_spaces_short", { width: effectiveTabWidth });
- return (note.type === "code" &&
+ return (noteType === "code" &&
<StatusBarDropdown
icon="bx bx-right-indent"
text={statusText}
@@ -553,13 +555,14 @@ function TabWidthSwitcher({ note, noteContext }: StatusBarContext) {
//#region Code note switcher
function CodeNoteSwitcher({ note }: StatusBarContext) {
const [ modalShown, setModalShown ] = useState(false);
+ const noteType = useNoteProperty(note, "type");
const currentNoteMime = useNoteProperty(note, "mime");
const { enabledMimeTypes, allMimeTypes } = useMimeTypes();
const correspondingMimeType = useMemo(() => (
allMimeTypes.find(m => m.mime === currentNoteMime)
), [ allMimeTypes, currentNoteMime ]);
- return (note.type === "code" &&
+ return (noteType === "code" &&
<>
<StatusBarDropdown
icon={correspondingMimeType?.icon ?? "bx bx-code-curly"}