diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 077d24fac..903cdc8b6 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1723,7 +1723,8 @@ }, "highlights_list_2": { "title": "Highlights List", - "options": "Options" + "options": "Options", + "modal_title": "Configure Highlights List" }, "quick-search": { "placeholder": "Quick search", diff --git a/apps/client/src/widgets/sidebar/HighlightsList.tsx b/apps/client/src/widgets/sidebar/HighlightsList.tsx index c3621d6f5..0eb3dcf03 100644 --- a/apps/client/src/widgets/sidebar/HighlightsList.tsx +++ b/apps/client/src/widgets/sidebar/HighlightsList.tsx @@ -1,8 +1,12 @@ import { CKTextEditor, ModelText } from "@triliumnext/ckeditor5"; +import { createPortal } from "preact/compat"; import { useCallback, useEffect, useState } from "preact/hooks"; import { t } from "../../services/i18n"; +import ActionButton from "../react/ActionButton"; import { useActiveNoteContext, useContentElement, useIsNoteReadOnly, useNoteProperty, useTextEditor } from "../react/hooks"; +import Modal from "../react/Modal"; +import { HighlightsListOptions } from "../type_widgets/options/text_notes"; import RightPanelWidget from "./RightPanelWidget"; interface RawHighlight { @@ -21,12 +25,43 @@ export default function HighlightsList() { const { note, noteContext } = useActiveNoteContext(); const noteType = useNoteProperty(note, "type"); const { isReadOnly } = useIsNoteReadOnly(note, noteContext); + const [ shown, setShown ] = useState(false); return ( - - {noteType === "text" && isReadOnly && } - {noteType === "text" && !isReadOnly && } - + <> + { + e.stopPropagation(); + setShown(true); + }} + /> + )} + > + {noteType === "text" && isReadOnly && } + {noteType === "text" && !isReadOnly && } + + {createPortal(, document.body)} + + ); +} + +function HighlightListOptionsModal({ shown, setShown }: { shown: boolean, setShown(value: boolean): void }) { + return ( + setShown(false)} + > + + ); } diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.css b/apps/client/src/widgets/sidebar/RightPanelContainer.css index 3ec53abda..595656c29 100644 --- a/apps/client/src/widgets/sidebar/RightPanelContainer.css +++ b/apps/client/src/widgets/sidebar/RightPanelContainer.css @@ -14,6 +14,7 @@ body.experimental-feature-new-layout #right-pane { .card-header-title { padding-inline: 0.5em; + flex-grow: 1; } } 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 b17c2bb3d..7b6e15dda 100644 --- a/apps/client/src/widgets/type_widgets/options/text_notes.tsx +++ b/apps/client/src/widgets/type_widgets/options/text_notes.tsx @@ -265,10 +265,27 @@ function TableOfContent() { } function HighlightsList() { + return ( + + + + {!isNewLayout && ( + <> +
+
{t("highlights_list.visibility_title")}
+ {t("highlights_list.visibility_description")} + {t("highlights_list.shortcut_info")} + + )} +
+ ); +} + +export function HighlightsListOptions() { const [ highlightsList, setHighlightsList ] = useTriliumOptionJson("highlightsList"); return ( - + <> {t("highlights_list.description")} - - {!isNewLayout && ( - <> -
-
{t("highlights_list.visibility_title")}
- {t("highlights_list.visibility_description")} - {t("highlights_list.shortcut_info")} - - )} -
+ ); }