I’d like to pitch an idea for a ProseMirror add-on.

Say a user wants to suggest a change to a document (such as a grammar correction by a copy editor) which should be reviewed by someone else before accepting the change.

The interface could display deletions and additions to the user accordingly, and provide contextual menus to accept or reject the changes.

Any thoughts on the implementation?

My idea (unproven) would be to keep the original document around, and by comparing that with the new document (using a somewhat intelligent diff algorithm) determine which changes have been made at a given point. These are then simplified to a set of text insertions and deletions. Insertions are shown by marking the new text with a greenish style. Deletions are shown by inserting widgets (as per #139) with the deleted text styled red.

Keeping these synchronized as the document is edited (in an efficient way) is left as an exercise for the reader, for now. Also how the diff algorithm will work, and whether we want to be intelligent about moving pieces of content, will require further study.

I built a proof of concept for suggestions here. Select the Suggestion comment style. Then select some text and click the comment icon. Decide the type of suggestion. For insertion/replace, enter the text in the comment.

Because I don’t have roles for this demo, the comment will have an approve/reject which would not normally appear if you made the suggestion, but you get the idea.

I like the GoogleDocs approach better, where you make a change and it becomes a comment of the right type automatically.

I tried peteb’s proof of concept and also prefer Google Docs approach. These days, I’d expect that suggested changes can be copy-pasted elsewhere in a document, suggestions can be made offline and reconciled with collaborators, even when there are conflicts or some users’ permissions prevent them from accessing a given suggestion.

As a former coder and representing Product, I worked closely with someone who built a system supporting much of the above. We’re considering migrating to ProseMirror so are very interested in your technical choices.

If I understand correctly, tracking suggestions the same as regular edits would facilitate the above. Contrariwise, handling suggestions by applying them to a document snapshot and later identifying them with a diff algorithm would make the above functionality more difficult.

Hope that helps

I would be glad to modify the demo because I think we will need it to. How do you think it should work? Should I replicate GoogleDocs or do you have other ideas?

Sorry, I didn’t get a notification of your post so what I write here may be too late to be helpful :disappointed:

Google Docs allows user to enter Editing, Suggesting, or Viewing modes. Some users don’t have permission to edit a document without review, so are automatically in Suggesting mode. When in Suggesting mode, any changes are automatically marked for review by others. This seems more ergonomic than your demo which requires user to make a change then after-the-fact, mark it as a comment.

It can be useful to be able to review a document which has been changed either in Suggesting or in Editing mode (the latter are changes by folks who didn’t explicitly intend the changes to be reviewed). Therefore, in accord with marijn, it could be useful to be able to apply review to all changes over a given time period. However, we prefer to track changes as they’re made, rather than attempt to identify them after-the-fact by a difference. Tracking them as you go allows the system to distinguish who made a given change and when the change was made. It can also identify changes which confuse difference systems.

Thanks, I totally agree with you. I would want it to work like GoogleDocs. I built this whole library of tools as a proof of concept. We need all the functionality I showed in our application and wondered if ProseMirror could handle it. It can and much more! Still, it was intended to show only possibilities because developers asking if it could do this or do that and so I showed them in a simple way it was possible.

However, this was written in ProseMirror 0.7 and the architecture has changed dramatically since then. I am taking a break until 1.0, tables and the server-side is out before we dive into an actual implementation with some serious UX work like you suggest.