diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index b11110b9a8..a58bf44784 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1371,8 +1371,12 @@ "title": "System Tray", "enable_tray": "Enable tray (Trilium needs to be restarted for this change to take effect)" }, + "text_editor": { + "title": "Editor" + }, "heading_style": { - "title": "Heading Style", + "title": "Heading style", + "description": "Visual style for headings in text notes.", "plain": "Plain", "underline": "Underline", "markdown": "Markdown-style" @@ -1399,14 +1403,16 @@ "text_auto_read_only_size": { "title": "Automatic Read-Only Size", "description": "Automatic read-only note size is the size after which notes will be displayed in a read-only mode (for performance reasons).", - "label": "Automatic read-only size (text notes)", + "label": "Automatic read-only size", "unit": "characters" }, "custom_date_time_format": { - "title": "Custom Date/Time Format", + "title": "Date/time format", "description": "Customize the format of the date and time inserted via or the toolbar. See Day.js docs for available format tokens.", - "format_string": "Format string:", - "formatted_time": "Formatted date/time:" + "description_short": "Customize the format of the date and time inserted via the toolbar.", + "preview": "Preview: {{preview}}", + "format_string": "Format string", + "formatted_time": "Formatted date/time" }, "i18n": { "title": "Localization", diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx index ea47dddbf9..3968c96259 100644 --- a/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx +++ b/apps/client/src/widgets/type_widgets/options/components/OptionsRow.tsx @@ -1,6 +1,6 @@ import "./OptionsRow.css"; -import { cloneElement, VNode } from "preact"; +import { cloneElement, ComponentChildren, VNode } from "preact"; import FormToggle from "../../../react/FormToggle"; import { useUniqueName } from "../../../react/hooks"; @@ -8,7 +8,7 @@ import { useUniqueName } from "../../../react/hooks"; interface OptionsRowProps { name: string; label?: string; - description?: string; + description?: ComponentChildren; children: VNode; centered?: boolean; /** When true, stacks label above input with full-width input */ diff --git a/apps/client/src/widgets/type_widgets/options/text_notes.tsx b/apps/client/src/widgets/type_widgets/options/text_notes.tsx index b9ade4c56a..b130997d3f 100644 --- a/apps/client/src/widgets/type_widgets/options/text_notes.tsx +++ b/apps/client/src/widgets/type_widgets/options/text_notes.tsx @@ -2,8 +2,6 @@ import { normalizeMimeTypeForCKEditor } from "@triliumnext/commons"; import { 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"; import { t } from "../../../services/i18n"; @@ -12,13 +10,11 @@ import { formatDateTime, toggleBodyClass } from "../../../services/utils"; import FormCheckbox from "../../react/FormCheckbox"; import FormGroup from "../../react/FormGroup"; import FormRadioGroup from "../../react/FormRadioGroup"; -import { FormSelectGroup, FormSelectWithGroups } from "../../react/FormSelect"; +import FormSelect, { FormSelectGroup, FormSelectWithGroups } from "../../react/FormSelect"; import FormText from "../../react/FormText"; import FormTextBox, { FormTextBoxWithUnit } from "../../react/FormTextBox"; import { useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks"; -import KeyboardShortcut from "../../react/KeyboardShortcut"; import { getHtml } from "../../react/RawHtml"; -import AutoReadOnlySize from "./components/AutoReadOnlySize"; import CheckboxList from "./components/CheckboxList"; import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow"; import OptionsSection from "./components/OptionsSection"; @@ -30,12 +26,10 @@ export default function TextNoteSettings() { <> - + - - > ); } @@ -107,24 +101,48 @@ function EditorFeatures() { ); } -function HeadingStyle() { - const [ headingStyle, setHeadingStyle ] = useTriliumOption("headingStyle"); +function Editor() { + const [headingStyle, setHeadingStyle] = useTriliumOption("headingStyle"); + const [autoReadonlySize, setAutoReadonlySize] = useTriliumOption("autoReadonlySizeText"); + const [customDateTimeFormat, setCustomDateTimeFormat] = useTriliumOption("customDateTimeFormat"); useEffect(() => { toggleBodyClass("heading-style-", headingStyle); - }, [ headingStyle ]); + }, [headingStyle]); return ( - - + + + + + + + + + + {t("custom_date_time_format.description_short")} {t("custom_date_time_format.preview", { preview: formatDateTime(new Date(), customDateTimeFormat) })}>} + > + + ); } @@ -312,35 +330,3 @@ export function HighlightsListOptions() { ); } -function DateTimeFormatOptions() { - const [ customDateTimeFormat, setCustomDateTimeFormat ] = useTriliumOption("customDateTimeFormat"); - - return ( - - - as React.ReactElement, - doc: as React.ReactElement - }} - /> - - - - - - - - - - {formatDateTime(new Date(), customDateTimeFormat)} - - - - - ); -}