diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index 493640d25c..9d1721a97a 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -1,27 +1,29 @@ -import { DateSelectArg, EventChangeArg, EventMountArg, EventSourceFuncArg, LocaleInput, PluginDef } from "@fullcalendar/core/index.js"; -import { ViewModeProps } from "../interface"; -import Calendar from "./calendar"; -import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks"; import "./index.css"; -import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; -import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons"; + import { Calendar as FullCalendar } from "@fullcalendar/core"; -import { parseStartEndDateFromEvent, parseStartEndTimeFromEvent } from "./utils"; -import dialog from "../../../services/dialog"; -import { t } from "../../../services/i18n"; -import { buildEvents, buildEventsForCalendar } from "./event_builder"; -import { changeEvent, newEvent } from "./api"; -import froca from "../../../services/froca"; -import date_notes from "../../../services/date_notes"; -import appContext from "../../../components/app_context"; +import { DateSelectArg, EventChangeArg, EventMountArg, EventSourceFuncArg, LocaleInput, PluginDef } from "@fullcalendar/core/index.js"; import { DateClickArg } from "@fullcalendar/interaction"; -import FNote from "../../../entities/fnote"; -import Button, { ButtonGroup } from "../../react/Button"; -import ActionButton from "../../react/ActionButton"; +import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons"; import { RefObject } from "preact"; -import TouchBar, { TouchBarButton, TouchBarLabel, TouchBarSegmentedControl, TouchBarSpacer } from "../../react/TouchBar"; -import { openCalendarContextMenu } from "./context_menu"; +import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks"; + +import appContext from "../../../components/app_context"; +import FNote from "../../../entities/fnote"; +import date_notes from "../../../services/date_notes"; +import dialog from "../../../services/dialog"; +import froca from "../../../services/froca"; +import { t } from "../../../services/i18n"; import { isMobile } from "../../../services/utils"; +import ActionButton from "../../react/ActionButton"; +import Button, { ButtonGroup } from "../../react/Button"; +import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; +import TouchBar, { TouchBarButton, TouchBarLabel, TouchBarSegmentedControl, TouchBarSpacer } from "../../react/TouchBar"; +import { ViewModeProps } from "../interface"; +import { changeEvent, newEvent } from "./api"; +import Calendar from "./calendar"; +import { openCalendarContextMenu } from "./context_menu"; +import { buildEvents, buildEventsForCalendar } from "./event_builder"; +import { parseStartEndDateFromEvent, parseStartEndTimeFromEvent } from "./utils"; interface CalendarViewData { @@ -59,7 +61,7 @@ const CALENDAR_VIEWS = [ previousText: t("calendar.month_previous"), nextText: t("calendar.month_next") } -] +]; const SUPPORTED_CALENDAR_VIEW_TYPE = CALENDAR_VIEWS.map(v => v.type); @@ -75,6 +77,7 @@ export const LOCALE_MAPPINGS: Record Promise<{ de ru: () => import("@fullcalendar/core/locales/ru"), ja: () => import("@fullcalendar/core/locales/ja"), pt: () => import("@fullcalendar/core/locales/pt"), + pl: () => import("@fullcalendar/core/locales/pl"), "pt_br": () => import("@fullcalendar/core/locales/pt-br"), uk: () => import("@fullcalendar/core/locales/uk"), en: null, @@ -102,9 +105,9 @@ export default function CalendarView({ note, noteIds }: ViewModeProps { if (!isCalendarRoot) { return async () => await buildEvents(noteIds); - } else { - return async (e: EventSourceFuncArg) => await buildEventsForCalendar(note, e); - } + } + return async (e: EventSourceFuncArg) => await buildEventsForCalendar(note, e); + }, [isCalendarRoot, noteIds]); const plugins = usePlugins(isEditable, isCalendarRoot); @@ -178,7 +181,7 @@ function CalendarHeader({ calendarRef }: { calendarRef: RefObject calendarRef.current?.next()} /> - ) + ); } function usePlugins(isEditable: boolean, isCalendarRoot: boolean) { @@ -293,7 +296,7 @@ function useEventDisplayCustomization(parentNote: FNote) { if (promotedAttributes) { let promotedAttributesHtml = ""; for (const [name, value] of promotedAttributes) { - promotedAttributesHtml = promotedAttributesHtml + /*html*/`\ + promotedAttributesHtml = `${promotedAttributesHtml /*html*/}\ `; diff --git a/apps/client/src/widgets/type_widgets/MindMap.tsx b/apps/client/src/widgets/type_widgets/MindMap.tsx index 3b56313385..8c6b36eb7a 100644 --- a/apps/client/src/widgets/type_widgets/MindMap.tsx +++ b/apps/client/src/widgets/type_widgets/MindMap.tsx @@ -37,6 +37,7 @@ const LOCALE_MAPPINGS: Record it: "it", ja: "ja", pt: "pt", + pl: null, pt_br: "pt", ro: "ro", ru: "ru", diff --git a/apps/client/src/widgets/type_widgets/canvas/i18n.ts b/apps/client/src/widgets/type_widgets/canvas/i18n.ts index 47324abfcf..ba044032b4 100644 --- a/apps/client/src/widgets/type_widgets/canvas/i18n.ts +++ b/apps/client/src/widgets/type_widgets/canvas/i18n.ts @@ -13,6 +13,7 @@ export const LANGUAGE_MAPPINGS: Record { await expect(attachmentsList.locator(".pdf-attachment-item")).toHaveCount(0); }); +test("Download original PDF works", async ({ page, context }) => { + const app = new App(page, context); + await app.goto(); + await app.goToNoteInNewTab("Dacia Logan.pdf"); + const pdfHelper = new PdfHelper(app); + await pdfHelper.toBeInitialized(); + + const [ download ] = await Promise.all([ + page.waitForEvent("download"), + app.currentNoteSplit.locator(".icon-action.bx.bx-download").click() + ]); + expect(download).toBeDefined(); +}); + test("Layers listing works", async ({ page, context }) => { const app = new App(page, context); await app.goto(); @@ -108,4 +122,8 @@ class PdfHelper { async expectPageToBe(expectedPageNumber: number) { await expect(this.contentFrame.locator("#pageNumber")).toHaveValue(`${expectedPageNumber}`); } + + async toBeInitialized() { + await expect(this.contentFrame.locator("#pageNumber")).toBeVisible(); + } } diff --git a/packages/commons/src/lib/dayjs.ts b/packages/commons/src/lib/dayjs.ts index fd9de68428..7ed1d85513 100644 --- a/packages/commons/src/lib/dayjs.ts +++ b/packages/commons/src/lib/dayjs.ts @@ -47,6 +47,7 @@ export const DAYJS_LOADER: Record Promise import("dayjs/locale/ku.js"), "pt_br": () => import("dayjs/locale/pt-br.js"), "pt": () => import("dayjs/locale/pt.js"), + "pl": () => import("dayjs/locale/pl.js"), "ro": () => import("dayjs/locale/ro.js"), "ru": () => import("dayjs/locale/ru.js"), "tw": () => import("dayjs/locale/zh-tw.js"), diff --git a/packages/commons/src/lib/i18n.ts b/packages/commons/src/lib/i18n.ts index 9003ae786e..ac005c6456 100644 --- a/packages/commons/src/lib/i18n.ts +++ b/packages/commons/src/lib/i18n.ts @@ -23,6 +23,7 @@ const UNSORTED_LOCALES = [ { id: "ja", name: "日本語", electronLocale: "ja" }, { id: "pt_br", name: "Português (Brasil)", electronLocale: "pt_BR" }, { id: "pt", name: "Português (Portugal)", electronLocale: "pt_PT" }, + { id: "pl", name: "Polski", electronLocale: "pl" }, { id: "ro", name: "Română", electronLocale: "ro" }, { id: "ru", name: "Русский", electronLocale: "ru" }, { id: "tw", name: "繁體中文", electronLocale: "zh_TW" },