Update diff viewer to use body text as fallback for original text. see #109
This commit is contained in:
parent
ba4024ddbf
commit
7c606bcb71
1 changed files with 5 additions and 1 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue