0
0
Fork 0

修复Bug-504:高亮问题

Bug504-LiJia
李佳 2022-12-08 14:45:24 +08:00
parent e74f1ff477
commit f98da2696d
1 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ function getWord() {
function highLight() { function highLight() {
if (!isHighlight) return; if (!isHighlight) return;
let articleContent = document.getElementById("article").innerText; let articleContent = document.getElementById("text-content").innerText;
let pickedWords = document.getElementById("selected-words"); // words picked to the text area let pickedWords = document.getElementById("selected-words"); // words picked to the text area
let dictionaryWords = document.getElementById("selected-words2"); // words appearing in the user's new words list let dictionaryWords = document.getElementById("selected-words2"); // words appearing in the user's new words list
let allWords = pickedWords.value + " " + dictionaryWords.value; let allWords = pickedWords.value + " " + dictionaryWords.value;
@ -34,11 +34,11 @@ function highLight() {
articleContent = articleContent.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " <mark>" + list[i] + "</mark> "); articleContent = articleContent.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " <mark>" + list[i] + "</mark> ");
} }
} }
document.getElementById("article").innerHTML = articleContent; document.getElementById("text-content").innerHTML = articleContent;
} }
function cancelHighlighting() { function cancelHighlighting() {
let articleContent = document.getElementById("article").innerText; let articleContent = document.getElementById("text-content").innerText;
let pickedWords = document.getElementById("selected-words"); let pickedWords = document.getElementById("selected-words");
const dictionaryWords = document.getElementById("selected-words2"); const dictionaryWords = document.getElementById("selected-words2");
const list = pickedWords.value.split(" "); const list = pickedWords.value.split(" ");
@ -60,7 +60,7 @@ function cancelHighlighting() {
} }
} }
} }
document.getElementById("article").innerHTML = articleContent; document.getElementById("text-content").innerHTML = articleContent;
} }
function fillInWord() { function fillInWord() {