Skip to content

Build your personal knowledge base with Trilium Notes

client/AI chat: confirm item deletion in the highlights list

Adorian Dorancb32e297f63a
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 2836c41ef2..5ab5539865 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2075,6 +2075,7 @@
"highlights_empty": "No highlights yet. Select text in a message and choose \"Highlight\".",
"highlight_add": "Highlight",
"highlight_remove": "Remove highlight",
+ "highlight_remove_confirm": "Remove this highlight?",
"attach_file": "Attach image, PDF, or text file",
"remove_attachment": "Remove attachment",
"attachment_upload_failed": "Failed to upload \"{{name}}\".",
diff --git a/apps/client/src/widgets/sidebar/ChatHighlightsList.tsx b/apps/client/src/widgets/sidebar/ChatHighlightsList.tsx
index 5370c80e38..3d3a2369f6 100644
--- a/apps/client/src/widgets/sidebar/ChatHighlightsList.tsx
+++ b/apps/client/src/widgets/sidebar/ChatHighlightsList.tsx
@@ -1,5 +1,6 @@
import "./ChatHighlightsList.css";
+import dialog from "../../services/dialog";
import { t } from "../../services/i18n";
import ActionButton from "../react/ActionButton";
import { useGetContextData } from "../react/hooks";
@@ -26,8 +27,14 @@ export default function ChatHighlightsList() {
icon="bx bx-x"
text={t("llm_chat.highlight_remove")}
onClick={e => {
+ // Confirm here only: the list's small ✕ is easy to hit by accident,
+ // unlike the deliberate right-click "Remove highlight" on the text itself.
e.stopPropagation();
- data?.removeHighlight(highlight.id);
+ void (async () => {
+ if (await dialog.confirm(t("llm_chat.highlight_remove_confirm"))) {
+ data?.removeHighlight(highlight.id);
+ }
+ })();
}}
/>
</li>