Fixed a mistake in translateHTML.

This commit is contained in:
sub-hub
2024-05-06 17:14:27 +09:00
parent 9b3571beeb
commit ca57cf6108

View File

@@ -316,7 +316,6 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
let translated = await translate(node.textContent || "", reverse);
if (!reprocessDisplayScript) {
node.textContent = translated;
applyMarkdownToNode(node);
return;
}
@@ -326,6 +325,12 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
"editdisplay",
chatID
);
// If the translation is the same, don't replace the node
if (translated == processedTranslated) {
node.textContent = processedTranslated;
applyMarkdownToNode(node)
return;
}
// Replace the old node with the new one
const newNode = document.createElement(