Sort text replacements better to avoid overlaps, fixes #334
This commit is contained in:
parent
fc2c53f840
commit
4435828ff7
1 changed files with 9 additions and 1 deletions
|
@ -235,7 +235,15 @@ function enhanceHtmlEntities(simpleText) {
|
|||
return simpleText.replace(ampRegExp, "&").replace(ltRegExp, "<").replace(gtRegExp, ">");//.replace(rawNewLineRegExp, "<br>");
|
||||
}
|
||||
|
||||
function messageInsertionSorter(a, b) { return (b.offset+b.removeLength) - (a.offset+a.removeLength) }
|
||||
function messageInsertionSorter(a, b) {
|
||||
if ((b.offset + b.removeLength) > (a.offset + a.removeLength)) {
|
||||
return 1;
|
||||
}
|
||||
if ((b.offset + b.removeLength) < (a.offset + a.removeLength)) {
|
||||
return -1;
|
||||
}
|
||||
return b.offset - a.offset;
|
||||
}
|
||||
|
||||
function enhanceMessageText(formattedText, ignoreEntities) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue