Skip to content

Build your personal knowledge base with Trilium Notes

chore(client): address requested changes from Gemini

Elian Doran993c4629f134
diff --git a/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx b/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx
index 253264c780..00daae89e5 100644
--- a/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx
+++ b/apps/client/src/widgets/ribbon/BasicPropertiesTab.tsx
@@ -164,15 +164,14 @@ export function NoteTypeCodeNoteList({ currentMimeType, mimeTypes, changeNoteTyp
export function useMimeTypes() {
const [ codeNotesMimeTypes ] = useTriliumOption("codeNotesMimeTypes");
- const mimeTypes = useMemo(() => {
+ return useMemo(() => {
mime_types.loadMimeTypes();
const allMimeTypes = mime_types.getMimeTypes();
return {
- enabledMimeTypes: allMimeTypes.filter(mimeType => mimeType.enabled),
+ enabledMimeTypes: allMimeTypes.filter(mimeType => mimeType?.enabled),
allMimeTypes
};
}, [ codeNotesMimeTypes ]); // eslint-disable-line react-hooks/exhaustive-deps
- return mimeTypes;
}
export function NoteTypeOptionsModal({ modalShown, setModalShown }: { modalShown: boolean, setModalShown: (shown: boolean) => void }) {
diff --git a/apps/client/src/widgets/type_widgets/text/config.ts b/apps/client/src/widgets/type_widgets/text/config.ts
index 5a23ce110e..bfbbe7cdce 100644
--- a/apps/client/src/widgets/type_widgets/text/config.ts
+++ b/apps/client/src/widgets/type_widgets/text/config.ts
@@ -258,7 +258,7 @@ function buildListOfLanguages() {
// The `env=frontend`/`env=backend` JavaScript variants are Trilium script environments,
// which are meaningless inside a (display-only) code block. Plain `text/javascript`
// already provides JavaScript highlighting, so omit the script-specific variants here.
- .filter((mt) => !mt.mime.startsWith("application/javascript;env="))
+ .filter((mt) => mt.mime && !mt.mime.startsWith("application/javascript;env="))
.map((mt) => ({
language: normalizeMimeTypeForCKEditor(mt.mime),
label: mt.title