Update diff viewer to use body text as fallback for original text. see #109

This commit is contained in:
mic 2025-03-22 17:17:17 +01:00
parent ba4024ddbf
commit 7c606bcb71

View file

@ -254,7 +254,11 @@ class MessagesArea extends HTMLElement {
diffvButton.textContent = 'Show differences'; diffvButton.textContent = 'Show differences';
diffvButton.addEventListener('click', async () => { diffvButton.addEventListener('click', async () => {
let strippedText = fullTextHTMLAtAssignment.replace(/<\/?[^>]+(>|$)/g, ""); let strippedText = fullTextHTMLAtAssignment.replace(/<\/?[^>]+(>|$)/g, "");
this.appendDiffViewer(promptData.prompt_info?.selection_text, strippedText); let originalText = promptData.prompt_info?.selection_text;
if((originalText == null) || (originalText == "")) {
originalText = promptData.prompt_info?.body_text;
}
this.appendDiffViewer(originalText, strippedText);
}); });
actionButtons.appendChild(diffvButton); actionButtons.appendChild(diffvButton);
} }