garysieling / jquery-highlighttextarea

http://garysieling.github.io/jquery-highlighttextarea/
156 stars 75 forks source link

Additional attribute for Tooltips and multidimensional word list #43

Open medienverbinder opened 9 years ago

medienverbinder commented 9 years ago

Thanks for the great plugin! I use it in order to recognize the input of certain words with a list of words from a Database. I would like to expand the highlighted entries with tooltips to describe these Words.

Here is my question:

Where I should start in order to support multidimensional arrays so that I can attach a additional attribute which I can use to explain the highlightet words with tooltips?

Best Regards!

mistic100 commented 9 years ago

Hu I don't know... read the code ? it's not that complex

Highlighter.prototype.highlight is the method which populate the highlight overlay Utilities.cleanWords is used to normalize the words list

This method is not documented by inputs can be

['word1', 'word2'] // will use global color

or

{
  'color1': ['word1-1', 'word1-2'],
  'color2': 'word2' // optional array
}

and the output is

{
  'color1': ['word1-1', 'word1-2'],
  'color2': ['word2']
}

up to you to allow another form to store data, and use them to initialize a tooltip

medienverbinder commented 9 years ago

Wow! That was a quick answer! Thanks for the explanation ... I'm going to just watch these methods and see how I get on. (Thats my new year's resolution :-))

By the way...Happy New Year!