feat(chat): confirm before deleting a message

Use the existing styledConfirm modal before destructive chat message deletion so accidental clicks can be cancelled.
This commit is contained in:
hemant singh
2026-06-15 11:41:12 +05:30
committed by GitHub
parent ebbcdc15af
commit faf27c4a90
+9
View File
@@ -4481,6 +4481,15 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
* Delete an AI message and its preceding user message from the conversation.
*/
export async function deleteMessage(msgElement) {
if (uiModule && uiModule.styledConfirm) {
const ok = await uiModule.styledConfirm('Delete this message?', {
confirmText: 'Delete',
cancelText: 'Cancel',
danger: true,
});
if (!ok) return;
}
const box = document.getElementById('chat-history');
const allMsgs = Array.from(box.querySelectorAll('.msg'));
const clickedIndex = allMsgs.indexOf(msgElement);