Closed jptannus closed 10 years ago
I changed the _stepThroughMatches function that was like this:
if (curNode.nodeType === 3) {
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
// We've found the ending
endNode = curNode;
endNodeIndex = matchLocation[1] - atIndex;
} else if (startNode) {
// Intersecting node
innerNodes.push(curNode);
}
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
// We've found the match start
startNode = curNode;
startNodeIndex = matchLocation[0] - atIndex;
}
atIndex += curNode.length;
}
to this:
if (curNode.nodeType === 3) {
if (startNode) {
// Intersecting node
innerNodes.push(curNode);
}
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
// We've found the match start
startNode = curNode;
startNodeIndex = $(curNode).text().indexOf(matchLocation[2][0]);
endNode = curNode;
endNodeIndex = startNodeIndex + matchLocation[2][0].length;
}
atIndex += curNode.length;
}
I'm using the jquery spellchecker with CKEditor. When I have a lot of empty lines between paragraphs the incorrect word highlight is inserted in a wrong position according to the number of empty lines above it.
The first and right behavior:
If I add one empty line before it:
If I add two empty lines before it:
I think it is something in "_stepThroughMatches" method but I'm not sure yet.