feat(badges/content): add badge for custom CSS

This commit is contained in:
Elian Doran 2026-02-14 12:05:24 +02:00
parent 7a3e7fccec
commit 866d3110da
No known key found for this signature in database
2 changed files with 10 additions and 3 deletions

View File

@ -2294,6 +2294,7 @@
"type_backend_script": "Backend script",
"type_frontend_script": "Frontend script",
"type_widget": "Widget",
"type_app_css": "Custom CSS",
"toggle_tooltip_enable_tooltip": "Click to enable this {{type}}.",
"toggle_tooltip_disable_tooltip": "Click to disable this {{type}}.",
"menu_docs": "Open documentation",

View File

@ -10,8 +10,8 @@ import { FormDropdownDivider, FormDropdownSubmenu, FormListItem } from "../react
import FormToggle from "../react/FormToggle";
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";
const DANGEROUS_ATTRIBUTES = BUILTIN_ATTRIBUTES.filter(a => a.isDangerous);
const activeContentLabels = [ "iconPack", "widget" ] as const;
const DANGEROUS_ATTRIBUTES = BUILTIN_ATTRIBUTES.filter(a => a.isDangerous || a.name === "appCss");
const activeContentLabels = [ "iconPack", "widget", "appCss" ] as const;
const typeMappings: Record<ActiveContentInfo["type"], {
icon: string;
@ -38,6 +38,10 @@ const typeMappings: Record<ActiveContentInfo["type"], {
widget: {
icon: "bx bxs-widget",
helpPage: "MgibgPcfeuGz"
},
appCss: {
icon: "bx bxs-file-css",
helpPage: "AlhDUqhENtH7"
}
};
@ -168,6 +172,8 @@ function getTranslationForType(type: ActiveContentInfo["type"]) {
return t("active_content_badges.type_frontend_script");
case "widget":
return t("active_content_badges.type_widget");
case "appCss":
return t("active_content_badges.type_app_css");
}
}
@ -205,7 +211,7 @@ function getNameWithoutPrefix(name: string) {
}
interface ActiveContentInfo {
type: "iconPack" | "backendScript" | "frontendScript" | "widget";
type: "iconPack" | "backendScript" | "frontendScript" | "widget" | "appCss";
isEnabled: boolean;
}