Comment system in rich text editor

So for my Saas platform I want to make it possible to edit your document within the platform. As a more advanced option, I wanted to make it so a user could add comments to the document just like you can do using word. Is it possible to make a word like comment system and if so how would I approach it?