Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(mobile/tab_switcher): bypass weird regression in typecheck regarding React types
Elian Doran5f20ce87a701
diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsxindex 9070902535..f6e5a51556 100644--- a/apps/client/src/widgets/layout/InlineTitle.tsx+++ b/apps/client/src/widgets/layout/InlineTitle.tsx@@ -5,6 +5,7 @@ import { Tooltip } from "bootstrap";import clsx from "clsx";import { ComponentChild } from "preact";import { useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";+import type React from "react";import { Trans } from "react-i18next";import FNote from "../../entities/fnote";diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsxindex 7bbbd3e345..51204b015e 100644--- a/apps/client/src/widgets/note_icon.tsx+++ b/apps/client/src/widgets/note_icon.tsx@@ -6,6 +6,7 @@ import clsx from "clsx";import { t } from "i18next";import { CSSProperties, RefObject } from "preact";import { useEffect, useMemo, useRef, useState } from "preact/hooks";+import type React from "react";import { CellComponentProps, Grid } from "react-window";import FNote from "../entities/fnote";@@ -153,10 +154,10 @@ function NoteIconList({ note, dropdownRef }: {function IconItemCell({ rowIndex, columnIndex, style, filteredIcons }: CellComponentProps<{filteredIcons: IconWithName[];-}>): React.JSX.Element {+}>) {const iconIndex = rowIndex * 12 + columnIndex;const iconData = filteredIcons[iconIndex] as IconWithName | undefined;- if (!iconData) return <></>;+ if (!iconData) return <></> as React.ReactElement;const { id, terms, iconPack } = iconData;return (@@ -166,7 +167,7 @@ function IconItemCell({ rowIndex, columnIndex, style, filteredIcons }: CellCompotitle={t("note_icon.icon_tooltip", { name: terms?.[0] ?? id, iconPack })}style={style as CSSProperties}/>- );+ ) as React.ReactElement;}function IconFilterContent({ filterByPrefix, setFilterByPrefix }: {diff --git a/apps/client/src/widgets/react/Modal.tsx b/apps/client/src/widgets/react/Modal.tsxindex 917c3bd996..e7a7c721f8 100644--- a/apps/client/src/widgets/react/Modal.tsx+++ b/apps/client/src/widgets/react/Modal.tsx@@ -1,9 +1,8 @@import { Modal as BootstrapModal } from "bootstrap";import clsx from "clsx";-import { ComponentChildren } from "preact";-import type { CSSProperties, RefObject } from "preact/compat";+import { ComponentChildren, CSSProperties, RefObject } from "preact";import { memo } from "preact/compat";-import { useEffect, useMemo,useRef } from "preact/hooks";+import { useEffect, useMemo, useRef } from "preact/hooks";import { openDialog } from "../../services/dialog";import { t } from "../../services/i18n";diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsxindex 6ac92b4207..e6813f8d2b 100644--- a/apps/client/src/widgets/type_widgets/options/other.tsx+++ b/apps/client/src/widgets/type_widgets/options/other.tsx@@ -1,20 +1,22 @@+import { SANITIZER_DEFAULT_ALLOWED_TAGS } from "@triliumnext/commons";+import { useMemo } from "preact/hooks";+import type React from "react";import { Trans } from "react-i18next";+import { t } from "../../../services/i18n";+import search from "../../../services/search";import server from "../../../services/server";import toast from "../../../services/toast";+import { isElectron } from "../../../services/utils";import Button from "../../react/Button";-import FormText from "../../react/FormText";-import OptionsSection from "./components/OptionsSection";-import TimeSelector from "./components/TimeSelector";-import { useMemo } from "preact/hooks";-import { useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";-import { SANITIZER_DEFAULT_ALLOWED_TAGS } from "@triliumnext/commons";import FormCheckbox from "../../react/FormCheckbox";import FormGroup from "../../react/FormGroup";-import search from "../../../services/search";-import FormTextBox, { FormTextBoxWithUnit } from "../../react/FormTextBox";import FormSelect from "../../react/FormSelect";-import { isElectron } from "../../../services/utils";+import FormText from "../../react/FormText";+import FormTextBox, { FormTextBoxWithUnit } from "../../react/FormTextBox";+import { useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";+import OptionsSection from "./components/OptionsSection";+import TimeSelector from "./components/TimeSelector";export default function OtherSettings() {return (@@ -31,7 +33,7 @@ export default function OtherSettings() {<ShareSettings /><NetworkSettings /></>- )+ );}function SearchEngineSettings() {@@ -82,7 +84,7 @@ function SearchEngineSettings() {/></FormGroup></OptionsSection>- )+ );}function TrayOptionsSettings() {@@ -97,7 +99,7 @@ function TrayOptionsSettings() {onChange={trayEnabled => setDisableTray(!trayEnabled)}/></OptionsSection>- )+ );}function NoteErasureTimeout() {@@ -105,13 +107,13 @@ function NoteErasureTimeout() {<OptionsSection title={t("note_erasure_timeout.note_erasure_timeout_title")}><FormText>{t("note_erasure_timeout.note_erasure_description")}</FormText><FormGroup name="erase-entities-after" label={t("note_erasure_timeout.erase_notes_after")}>- <TimeSelector- name="erase-entities-after"+ <TimeSelector+ name="erase-entities-after"optionValueId="eraseEntitiesAfterTimeInSeconds" optionTimeScaleId="eraseEntitiesAfterTimeScale"/></FormGroup><FormText>{t("note_erasure_timeout.manual_erasing_description")}</FormText>-+<Buttontext={t("note_erasure_timeout.erase_deleted_notes_now")}onClick={() => {@@ -121,7 +123,7 @@ function NoteErasureTimeout() {}}/></OptionsSection>- )+ );}function AttachmentErasureTimeout() {@@ -145,7 +147,7 @@ function AttachmentErasureTimeout() {}}/></OptionsSection>- )+ );}function RevisionSnapshotInterval() {@@ -165,7 +167,7 @@ function RevisionSnapshotInterval() {/></FormGroup></OptionsSection>- )+ );}function RevisionSnapshotLimit() {@@ -176,7 +178,7 @@ function RevisionSnapshotLimit() {<FormText>{t("revisions_snapshot_limit.note_revisions_snapshot_limit_description")}</FormText><FormGroup name="revision-snapshot-number-limit">- <FormTextBoxWithUnit+ <FormTextBoxWithUnittype="number" min={-1}currentValue={revisionSnapshotNumberLimit}unit={t("revisions_snapshot_limit.snapshot_number_limit_unit")}@@ -197,7 +199,7 @@ function RevisionSnapshotLimit() {}}/></OptionsSection>- )+ );}function HtmlImportTags() {@@ -236,7 +238,7 @@ function HtmlImportTags() {onClick={() => setAllowedHtmlTags(SANITIZER_DEFAULT_ALLOWED_TAGS)}/></OptionsSection>- )+ );}function ShareSettings() {@@ -246,8 +248,8 @@ function ShareSettings() {return (<OptionsSection title={t("share.title")}><FormGroup name="redirectBareDomain" description={t("share.redirect_bare_domain_description")}>- <FormCheckbox- label={t(t("share.redirect_bare_domain"))}+ <FormCheckbox+ label={t(t("share.redirect_bare_domain"))}currentValue={redirectBareDomain}onChange={async value => {if (value) {@@ -264,17 +266,17 @@ function ShareSettings() {}setRedirectBareDomain(value);}}- />+ /></FormGroup><FormGroup name="showLoginInShareTheme" description={t("share.show_login_link_description")}>- <FormCheckbox+ <FormCheckboxlabel={t("share.show_login_link")}currentValue={showLogInShareTheme} onChange={setShowLogInShareTheme}/></FormGroup></OptionsSection>- )+ );}function NetworkSettings() {@@ -288,5 +290,5 @@ function NetworkSettings() {currentValue={checkForUpdates} onChange={setCheckForUpdates}/></OptionsSection>- )-}\ No newline at end of file+ );+}diff --git a/apps/client/src/widgets/type_widgets/options/text_notes.tsx b/apps/client/src/widgets/type_widgets/options/text_notes.tsxindex 7b6e15ddae..e2ff88b447 100644--- a/apps/client/src/widgets/type_widgets/options/text_notes.tsx+++ b/apps/client/src/widgets/type_widgets/options/text_notes.tsx@@ -2,6 +2,7 @@ import { normalizeMimeTypeForCKEditor, type OptionNames } from "@triliumnext/comimport { Themes } from "@triliumnext/highlightjs";import type { CSSProperties } from "preact/compat";import { useEffect, useMemo, useState } from "preact/hooks";+import type React from "react";import { Trans } from "react-i18next";import { isExperimentalFeatureEnabled } from "../../../services/experimental_features";