javascriptjquerywmdwysiwym

how can we highlight text and apply colours, make hyperlink of selected portions


I want to select the bunch of text (selection is dependent on the user), it will be plain text. As the user will select the text range, I need to highlight it, and apply some colors to indicate. If possible I need to make them as hyperlinks so that they can navigate to all highlighted regions in the text.

The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dogm The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog,The quick brown fox jumps over the lazy dog,The quick brown fox jumps over the lazy dog

User may select any textrange, based on selection I need to highlight it.

  1. Any jQuery lib with demo or documentation to achieve it?
  2. Can we use WMD Editor for this? It will be suit our requirement, but as I don't know whether wmd-editor has the functionality to support it. Or else any editor which has live preview, and highlighting text.

As I searched the jQuery libray, I am unable to find the libraries which suits my needs.


Solution

  • i used Rangy Library to accomplish the task. Rangy Javascript.