fix: 🐛 fix calendar option error

This commit is contained in:
Jin 2025-03-31 21:40:33 +02:00
parent a80932d3f9
commit ae7aaaf263
3 changed files with 10 additions and 6 deletions

View File

@ -58,7 +58,7 @@ const TPL = `
<div class="option-row min-days-row" style="display: none;"> <div class="option-row min-days-row" style="display: none;">
<label for="min-days-in-first-week">${t("i18n.min-days-in-first-week")}</label> <label for="min-days-in-first-week">${t("i18n.min-days-in-first-week")}</label>
<select id="min-days-in-first-week" class="form-select"> <select id="min-days-in-first-week" class="form-select">
${Array.from({length: 7}, (_, i) => i + 1) ${Array.from({ length: 7 }, (_, i) => i + 1)
.map(num => `<option value="${num}">${num}</option>`) .map(num => `<option value="${num}">${num}</option>`)
.join('')} .join('')}
</select> </select>
@ -148,6 +148,8 @@ export default class LocalizationOptions extends OptionsWidget {
} else { } else {
$minDaysRow.hide(); $minDaysRow.hide();
} }
this.updateOption("firstWeekOfYear", value);
}); });
const currentValue = this.$widget.find('input[name="first-week-of-year"]:checked').val(); const currentValue = this.$widget.find('input[name="first-week-of-year"]:checked').val();
@ -156,7 +158,7 @@ export default class LocalizationOptions extends OptionsWidget {
} }
this.$widget.find("#min-days-in-first-week").on("change", () => { this.$widget.find("#min-days-in-first-week").on("change", () => {
const minDays = String(this.$widget.find("#min-days-in-first-week").val()); const minDays = this.$widget.find("#min-days-in-first-week").val();
this.updateOption("minDaysInFirstWeek", minDays); this.updateOption("minDaysInFirstWeek", minDays);
}); });

View File

@ -1,4 +1,4 @@
import type { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "../../../../../services/options_interface.js"; import type { FilterOptionsByType, OptionMap, OptionNames } from "../../../../../services/options_interface.js";
import type { EventData, EventListener } from "../../../components/app_context.js"; import type { EventData, EventListener } from "../../../components/app_context.js";
import type FNote from "../../../entities/fnote.js"; import type FNote from "../../../entities/fnote.js";
import { t } from "../../../services/i18n.js"; import { t } from "../../../services/i18n.js";
@ -45,7 +45,7 @@ export default class OptionsWidget extends NoteContextAwareWidget implements Eve
$checkbox.prop("checked", optionValue === "true"); $checkbox.prop("checked", optionValue === "true");
} }
optionsLoaded(options: OptionMap) {} optionsLoaded(options: OptionMap) { }
async refresh() { async refresh() {
this.toggleInt(this.isEnabled()); this.toggleInt(this.isEnabled());

View File

@ -72,6 +72,8 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
"locale", "locale",
"formattingLocale", "formattingLocale",
"firstDayOfWeek", "firstDayOfWeek",
"firstWeekOfYear",
"minDaysInFirstWeek",
"languages", "languages",
"textNoteEditorType", "textNoteEditorType",
"textNoteEditorMultilineToolbar", "textNoteEditorMultilineToolbar",