forked from mrlan/EnglishPal
修复Bug-504:高亮问题
parent
e74f1ff477
commit
f98da2696d
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue