d1vanov / libquentier

Set of Qt/C++ APIs for feature rich desktop clients for Evernote service
GNU Lesser General Public License v3.0
8 stars 5 forks source link

Unify word's highlighting methods #51

Open michaelkn opened 6 years ago

michaelkn commented 6 years ago

There are (at least) two places where the words' highlighting is used: Find and replace and Spell checker. Perhaps, the newly added findAndReplaceDOMText script could help in both places.

findAndReplaceDOMText(node, {
 find: 'something',
 wrap: 'span',
 wrapClass: 'hilitorHelper'
});
d1vanov commented 6 years ago

Unification is always welcome, spell checker's code for misspelled words detection is quite messy currently as it tries hard to account for many possibilities - like for the parts of the misspelled word to be located in adjacent yet different DOM nodes. Given the demo page of findAndReplaceDOMText, it can handle all such tricky cases. Would be nice to try employing this script in spell checker as well.