1

We've had a a client add a new "requirement" to a project we're about to start and it's thrown us a little bit. From the end users perspective it's simple, but as a developer I have no idea how to implement it!

What our user would like is for a web form text box (ideally a rich text editor, such as CKEditor) to track the changes a user makes to the content. Note this is not to track if a change has been made but to actually highlight those changes. Basically they're after Microsoft Word's "Track Changes" feature!

The idea is as a request goes between users if one users alters a text box containing a large amount of text the next user will be easily able to identify what's changed.

I'd love to hear if anybody has ever done something similar or anybody's thoughts on if or how it may be possible?

Michael
  • 8,362
  • 6
  • 61
  • 88
Paul
  • 69
  • 2
  • 10
  • Thanks for the quick feedback! I should have added we can easily version the content so we could diff against an earlier version, however I wasn't aware of reliable diff algorithms which would allow us to show what's been added and deleted (especially if large amounts of text has been changed) – Paul Nov 11 '10 at 16:43
  • I'll take a look at the options provided in the other question too. Thanks! – Paul Nov 11 '10 at 16:45
  • Oh - and the solution is asp.net based so we'd need to try to avoid installing PHP on the server (no developers here have the necessary skils to maintain it) – Paul Nov 11 '10 at 16:48

3 Answers3

0

Some one already posted an excellent answer here:

How to highlight changes/difference in one text paragraph from the other?

Community
  • 1
  • 1
Sam
  • 565
  • 3
  • 8
  • Thanks - although this was all PHP based it set me off on the right track and I've found a library called HTMLDiff at http://htmldiff.codeplex.com/ which I'm now looking at to solve the issue – Paul Nov 12 '10 at 10:17
0

Hmmm... well you could store the contents of the box in a variable, then use a diff algorithm (there must be some out there, surely) to check the changes onChange and format appropriately, but will only display the difference when the user clicks outside the box. Will that be good enough? If not, you could compare the onkeypress event with the onkeyup event, and apply formatting to the difference?

Nathan MacInnes
  • 11,033
  • 4
  • 35
  • 50
0

Well, you need some kind of content management solution for that. It needs to have versioning so you can store different versions of the content. If your content is just text it won't be hard to do diff. If it is structured in some way (HTML or other format different from text) it might be pretty hard to identify changes. I think in the latter case you could mark new text with invisible tags, something like <edition version="1.0"> </edition> that the editor will highlight. You could also make tag for deleted text. And you could just not highlight the text and don't show the deletions as an option.

Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81
  • Thanks - I would have accepted your answer too if I could have as they've all helped me get to the solutions. Much appreciated! – Paul Nov 12 '10 at 10:18