From ce8b5e33da6a74b9c639c593b518cf6ea1674998 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:55:07 +0200 Subject: [PATCH] fix regressions --- src/public/app/widgets/buttons/calendar.js | 25 +++--- .../widgets/buttons/right_dropdown_button.js | 1 + .../widgets/ribbon_widgets/book_properties.js | 2 +- .../app/widgets/search_options/ancestor.js | 2 +- .../type_widgets/options/appearance/fonts.js | 8 +- .../type_widgets/options/appearance/i18n.js | 4 +- .../type_widgets/options/appearance/theme.js | 2 +- .../widgets/type_widgets/options/backup.js | 6 +- .../options/code_notes/code_mime_types.js | 2 +- .../options/code_notes/vim_key_bindings.js | 2 +- .../options/code_notes/wrap_lines.js | 2 +- .../options/other/network_connections.js | 2 +- .../options/text_notes/heading_style.js | 2 +- .../options/text_notes/highlights_list.js | 10 +-- src/public/stylesheets/calendar.css | 5 ++ src/public/stylesheets/style.css | 86 +++++++++++++++---- src/public/translations/cn/translation.json | 4 +- 17 files changed, 113 insertions(+), 52 deletions(-) diff --git a/src/public/app/widgets/buttons/calendar.js b/src/public/app/widgets/buttons/calendar.js index a6021f308..8437dc91f 100644 --- a/src/public/app/widgets/buttons/calendar.js +++ b/src/public/app/widgets/buttons/calendar.js @@ -74,12 +74,12 @@ export default class CalendarWidget extends RightDropdownButtonWidget { doRender() { super.doRender(); - + this.$month = this.$dropdownContent.find('[data-calendar-area="month"]'); this.$weekHeader = this.$dropdownContent.find(".calendar-week"); - + this.manageFirstDayOfWeek(); - + // Month navigation this.$monthSelect = this.$dropdownContent.find('[data-calendar-input="month"]'); this.$monthSelect.on("input", (e) => { @@ -88,10 +88,10 @@ export default class CalendarWidget extends RightDropdownButtonWidget { }); this.$next = this.$dropdownContent.find('[data-calendar-toggle="next"]'); this.$next.on('click', () => { - this.date.setMonth(this.date.getMonth() + 1); + this.date.setMonth(this.date.getMonth() + 1); this.createMonth(); }); - this.$previous = this.$dropdownContent.find('[data-calendar-toggle="previous"]'); + this.$previous = this.$dropdownContent.find('[data-calendar-toggle="previous"]'); this.$previous.on('click', e => { this.date.setMonth(this.date.getMonth() - 1); this.createMonth(); @@ -108,7 +108,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget { this.date.setFullYear(this.date.getFullYear() + 1); this.createMonth(); }); - this.$previousYear = this.$dropdownContent.find('[data-calendar-toggle="previousYear"]'); + this.$previousYear = this.$dropdownContent.find('[data-calendar-toggle="previousYear"]'); this.$previousYear.on('click', e => { this.date.setFullYear(this.date.getFullYear() - 1); this.createMonth(); @@ -123,12 +123,13 @@ export default class CalendarWidget extends RightDropdownButtonWidget { if (note) { appContext.tabManager.getActiveContext().setNote(note.noteId); + this.dropdown.hide(); } else { toastService.showError(t("calendar.cannot_find_day_note")); } - }); - + }); + // Prevent dismissing the calendar popup by clicking on an empty space inside it. this.$dropdownContent.on("click", (e) => e.stopPropagation()); } @@ -137,9 +138,9 @@ export default class CalendarWidget extends RightDropdownButtonWidget { this.firstDayOfWeek = options.getInt("firstDayOfWeek"); // Generate the list of days of the week taking into consideration the user's selected first day of week. - let localeDaysOfWeek = [ ...DAYS_OF_WEEK ]; + let localeDaysOfWeek = [...DAYS_OF_WEEK]; const daysToBeAddedAtEnd = localeDaysOfWeek.splice(0, this.firstDayOfWeek); - localeDaysOfWeek = [ ...localeDaysOfWeek, ...daysToBeAddedAtEnd ]; + localeDaysOfWeek = [...localeDaysOfWeek, ...daysToBeAddedAtEnd]; this.$weekHeader.html(localeDaysOfWeek.map((el) => `${el}`)); } @@ -235,11 +236,11 @@ export default class CalendarWidget extends RightDropdownButtonWidget { this.$yearSelect.val(this.date.getFullYear()); } - async entitiesReloadedEvent({loadResults}) { + async entitiesReloadedEvent({ loadResults }) { if (!loadResults.getOptionNames().includes("firstDayOfWeek")) { return; } - + this.manageFirstDayOfWeek(); this.createMonth(); } diff --git a/src/public/app/widgets/buttons/right_dropdown_button.js b/src/public/app/widgets/buttons/right_dropdown_button.js index 236b1f0be..ab6ca0bc2 100644 --- a/src/public/app/widgets/buttons/right_dropdown_button.js +++ b/src/public/app/widgets/buttons/right_dropdown_button.js @@ -30,6 +30,7 @@ export default class RightDropdownButtonWidget extends BasicWidget { doRender() { this.$widget = $(TPL); this.$dropdownMenu = this.$widget.find(".dropdown-menu"); + this.dropdown = bootstrap.Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']")); this.$tooltip = this.$widget.find(".tooltip-trigger").attr("title", this.title); this.tooltip = new bootstrap.Tooltip(this.$tooltip); diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.js b/src/public/app/widgets/ribbon_widgets/book_properties.js index 74cefef1f..c597f02b6 100644 --- a/src/public/app/widgets/ribbon_widgets/book_properties.js +++ b/src/public/app/widgets/ribbon_widgets/book_properties.js @@ -18,7 +18,7 @@ const TPL = `