Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- highlightText = (node, words) => {
- const fileText = node;
- const highlighted_text = words.reduce((text, word) => {
- return text.replace( new RegExp(word, 'g'), `<a id="${this.guidGenerator()}" class="highlighted">${word}</a>` );
- }, fileText);
- node = highlighted_text;
- console.log('node: ', node);
- // console.log(words);
- // this.highlightText(document.querySelector('#text_snippet'), words);
- }
Add Comment
Please, Sign In to add comment