mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: infinite loop when mentioning in IE11
This commit is contained in:
parent
74931eedfd
commit
1e4f0ac216
@ -81,13 +81,16 @@ function allowedBoundary(content, index, utils) {
|
||||
}
|
||||
|
||||
function textPostProcess(content, state, ruler) {
|
||||
let result = null,
|
||||
match,
|
||||
pos = 0;
|
||||
let result = null;
|
||||
let match;
|
||||
let pos = 0;
|
||||
|
||||
const matcher = ruler.getMatcher();
|
||||
|
||||
while ((match = matcher.exec(content))) {
|
||||
while (match = matcher.exec(content)) {
|
||||
// something is wrong
|
||||
if (match.index < pos) break;
|
||||
|
||||
// check boundary
|
||||
if (match.index > 0) {
|
||||
if (!allowedBoundary(content, match.index - 1, state.md.utils)) {
|
||||
@ -104,15 +107,14 @@ function textPostProcess(content, state, ruler) {
|
||||
}
|
||||
}
|
||||
|
||||
result = result || [];
|
||||
|
||||
if (match.index > pos) {
|
||||
result = result || [];
|
||||
let token = new state.Token("text", "", 0);
|
||||
token.content = content.slice(pos, match.index);
|
||||
result.push(token);
|
||||
}
|
||||
|
||||
result = result || [];
|
||||
|
||||
ruler.applyRule(result, match, state);
|
||||
|
||||
pos = match.index + match[0].length;
|
||||
|
Loading…
Reference in New Issue
Block a user