Open shriniv78 opened 11 years ago
I've fixed it in my project.
we need to update code in HtmlParser.prototype.highlightWords method.
find
var regExp = ''; regExp += '([^' + letterChars + '])'; regExp += '(' + incorrectWords.join('|') + ')'; regExp += '(?=[^' + letterChars + '])';
and replace it with
var regExp = ''; regExp += '([^' + letterChars + ']?)'; regExp += '(' + incorrectWords.join('|') + ')'; regExp += '(?=[^' + letterChars + ']?)';
(in 2 and 4 rows "?"-sign added before closing bracket)
The regex fix listed by motan does not work for me, because it highlights misspelled words in other words. For instance if "wor" were highlighted as misspelled, any "wor" in "word" would also be highlighted.
Any regex masters out there? The library as is does not highlight the first word, or words directly after a newline or html tag for me.
i replace it with
var regExp = ''; regExp += '(^|[^' + letterChars + '])'; regExp += '(' + incorrectWords.join('|') + ')'; regExp += '(?=[^' + letterChars + ']|$)';
The patch provided by tangruixing works well for me.
the last patch doesn't match last words in paragraphs that don't have a punctuation sign.
I propose this variant which matches both first and last words:
var regExp = ''; regExp += '(^|[^' + letterChars + ']?)'; regExp += '(' + incorrectWords.join('|') + ')'; regExp += '(?=[^' + letterChars + ']?)';
In the demo environment url below, if you erase everything and just type one bad spelling "eg: denounncing", the error style/event bind does not happen. Same issue in my local. I am using nhunspell, and newton for my backend.
Also, its the same issue if the first word or the last word contains has bad spelling.
http://jquery-spellchecker.badsyntax.co/ckeditor.html