user interface - Javascript, Text Annotations and Ideas -
i curious hear input others on problem i've been contemplating time now.
essentially present user text document , allow him/her make selections of text , annotate it. specific annotations aim achieve following:
- allow users make text selection, annotate it, save selection , annotation reference later
- (ui) support representing overlapped annotations. example if string where: "this test sentence example test sentence", user1 might have annotation on "is test sentence example" , user2 might have annotation on "for example".
- account situations document's text changes. annotations updated, if possible.
how tackle technical perspective?
some ideas i've had are:
- use javascript ranges , store annotation pair of integers like: (document_start_char, document_end_char). save pair in db.
- alternatively, using js text selected , save full text in db. (not sure how overlapping annotations)
- represent overlapped annotations applying css style highlight text darken "stack" of annotations overlap. smallest annotation have on top of "stack".
what thoughts or areas of improvement? how heck support document's text being updated without breaking annotations?
http://mark.koli.ch/2009/09/use-javascript-and-jquery-to-get-user-selected-text.html
http://mark.koli.ch/2009/09/05/get-selected-text-javascript.html
getting selected text easy. storing (or starting/ending points) joke. point number 3? if text changes?
if text changes, both original text , original selection coordinates stored won't equal current modified text. should aware of annotations present in text document, everytime changes, annotations referencing particular piece of changed text should updated, or deleted (maybe after quick comparison between before , after text: words missing? or words have been corrected?), seems struggling task.
i think storing entire text annotation in db essential, avoid being changed , annotation lost. way still have complete text annotated. should use sort of flag indicate start character of annotation, , if text changes, calculate difference in characters document text before change, , 1 after it, , find way new starting point of original annotation (assuming annotation part of document text has't changed).
dividing text document in many paragraphs possible should help, way separate different pieces of document , work on 1 one.
now see done! :)
Comments
Post a Comment