garysieling / jquery-highlighttextarea

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

fixed a few bugs #57

Closed adubrov closed 8 years ago

mistic100 commented 9 years ago

removing Utilities.htmlEntities is not a solution.

Did you look at the Use regular expressions (Smarty tags) example ? I doesn't work (not because of regexes but because of HTML)

adubrov commented 9 years ago

well, no. How would you suggest to fix bug, if we have "> some text with errrr" and it transforms to "> some text with errrr" with old start-end

mistic100 commented 9 years ago

I don't understand, I don't even know which problem you are talking about, give a real example.

I have no suggestions, I said in the readme I don't update the plugin anymore. Although I really appreciate contribution I won't merge something which break a existing working example.

adubrov commented 9 years ago

I want to highlight ">some text 123" - I want to highlight "123" for example. start: 12, end: 15. But html converts it to "& gt;some text 123", so now position is incorrect

mistic100 commented 9 years ago

so it's only a bug when using ranges instead of words ?

the only solution I see is to only allow ranges OR words (and not both) and then conditionally escape the text

if (!$.isEmptyObject(this.settings.words)) {
  text = Utilities.htmlEntities(this.$el.val());
  // rest of words highlighting
}
else if ($.isEmptyObject(this.settings.ranges)) {
  text = this.$el.val();
  // rest of ranges highlighting
}

honestly I don't see at all the interest of ranges highlighting

adubrov commented 9 years ago

Ok, thanks, I'll try it.

"honestly I don't see at all the interest of ranges highlighting"

In my case I do spell and grammar checking on server side. Server respond type of highlight and range. I think there are some others cases

garysieling commented 8 years ago

I have a similar use case (spelling/grammar checking on the server). I just took over maintenance of this, so I'll set up some test cases for this and see if there are any further issues in this area.