mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 13:56:11 +01:00
1.2 KiB
Vendored
1.2 KiB
Vendored
Options
Read an option
Add the import to the service (make sure the relative path is correct):
import options from "../../services/options.js";
Them simply read the option:
this.firstDayOfWeek = options.getInt("firstDayOfWeek");
Adding new options
Checkbox option
Refer to this example in backup.tsx:
export function AutomaticBackup() {
const [ dailyBackupEnabled, setDailyBackupEnabled ] = useTriliumOptionBool("dailyBackupEnabled");
return (
<OptionsSection title={t("backup.automatic_backup")}>
<FormMultiGroup label={t("backup.automatic_backup_description")}>
<FormCheckbox
name="daily-backup-enabled"
label={t("backup.enable_daily_backup")}
currentValue={dailyBackupEnabled} onChange={setDailyBackupEnabled}
/>
</FormMultiGroup>
<FormText>{t("backup.backup_recommendation")}</FormText>
</OptionsSection>
)
}
Tip
To trigger a UI refresh (e.g.
utils#reloadFrontendApp), simply pass atrueas the second argument touseTriliumOptionmethods.