diff --git a/_locales/en/messages.json b/_locales/en/messages.json index b654ddf6..32429f9d 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1214,5 +1214,13 @@ "noActiveCalendar": { "message": "No active calendar found!", "description": "" + }, + "btn_show_differences": { + "message": "Show differences", + "description": "" + }, + "chatgpt_win_diff_title": { + "message": "Differences between the original and the modified text", + "description": "" } } \ No newline at end of file diff --git a/api_webchat/messagesArea.js b/api_webchat/messagesArea.js index c4888060..bfc02123 100644 --- a/api_webchat/messagesArea.js +++ b/api_webchat/messagesArea.js @@ -45,7 +45,6 @@ messagesAreaStyle.textContent = ` line-height: 1.3; padding: 5px; border-radius: 10px; - } .message p{ margin: 0; @@ -95,12 +94,19 @@ messagesAreaStyle.textContent = ` background-color: #d4fcdc; display: inline; } - .removed { background-color: #fddddd; display: inline; text-decoration: line-through; } + @media (prefers-color-scheme: dark) { + .added { + background-color:rgb(0, 94, 0); + } + .removed { + background-color:rgb(90, 0, 0); + } + } `; messagesAreaTemplate.content.appendChild(messagesAreaStyle); @@ -254,7 +260,11 @@ class MessagesArea extends HTMLElement { diffvButton.textContent = 'Show differences'; diffvButton.addEventListener('click', async () => { 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); } diff --git a/js/mzta-chatgpt.js b/js/mzta-chatgpt.js index 182ae6f4..43379f5e 100644 --- a/js/mzta-chatgpt.js +++ b/js/mzta-chatgpt.js @@ -99,7 +99,7 @@ function chatpgt_scrollToBottom () { function addCustomDiv(prompt_action,tabId,mailMessageId) { // Create