I'm building a gramma-checker system for a client, where users can add comments/suggestions to a given text. When a user selects some text, a button appear to create a comment/suggestion to that given text selection. My problem comes when I want to save the text selection range in a database, along with the comment/suggestion.
I'm currently trying to solve the problem by using Rangy (http://rangy.googlecode.com/).
These are the ideas I'v tried so far:
- Using the rangy serializer to serialize the range. The problem with this approach is that the DOM is changing each time a new comment/suggestion is added, and therfore not allowing for a successful deserialization.
- Using the rangy selection wrapper and save that directly in the database, but like the idea above, the target elements content is changing with each comment/suggestion, which again makes the approach not work as intended.
Any suggestions to how I could solve this problem would be appriciated.