How do Google docs make their comments?

They allow you to select parts of the text and assign a comment to it ... So, how do you associate an object with something that is constantly changing?

Should every word be an object? How ... in the comment there will be only an array of words with which it is connected? and then change what is in this array when editing a document?

I feel that every word-on-object approach will lead to a slow web application. = \

Another issue I was thinking about: since this is a website, there are HTML tags everywhere ... what happens to the HTML tags surrounding the text selected for selection? what if the start or end of the selection starts / ends in the middle of the tag and ends / starts outside the tag?

+4
source share
1 answer

Obviously, I do not know how they do it. I'm just throwing an idea or two.

Think of it as bold text, not commenting. How would you overcome tag boundaries? You must end the bold before the closing tag and resume it in the new open tag.

Now you need to somehow group those (potentially fragmented) tags. This could probably be due to some kind of naming convention.

<ul> <li>This text <comment id="c1#0"> has been flagged for review.</comment></li> <li><comment id="c1#1">And this is more text</comment>to be reviewed.</li> </ul> 

Sound reasonable? Or have I sniffed board markers for too long?

0
source

All Articles