Fix overlapping highlights
This commit is contained in:
parent
3cc2844e1c
commit
10e4a95c7c
2 changed files with 8 additions and 7 deletions
|
@ -164,9 +164,6 @@
|
|||
"Teto Territory": {
|
||||
"color": "rgb(255, 100, 100)",
|
||||
"caseInsensitive": true
|
||||
},
|
||||
"Services": {
|
||||
|
||||
},
|
||||
"Teto": {
|
||||
"color": "rgb(255, 100, 100)",
|
||||
|
|
|
@ -171,16 +171,20 @@ function converter(html) {
|
|||
|
||||
var endContent = element.content.substring(termIndex + termKey.length, spanEnd)
|
||||
|
||||
var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ")
|
||||
var startContent = element.content.substring(spanStart, termIndex)
|
||||
var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ") + 1
|
||||
var startContent = element.content.substring(spanStart - 1, termIndex)
|
||||
|
||||
var style = ""
|
||||
var style = termProps.style || ""
|
||||
|
||||
if (termProps.color) {
|
||||
style += `color: ${termProps.color};`
|
||||
}
|
||||
|
||||
var replacement = `<span style="${style}">${startContent + highTable[index] + endContent}</span>`
|
||||
if (style.length > 2) {
|
||||
style = `style="${style}"`
|
||||
}
|
||||
|
||||
var replacement = `<span ${style}>${startContent + highTable[index] + endContent}</span>`
|
||||
|
||||
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue