Releasing prosemirror-suggestion-mode

Hi all, I created a suggestion-mode for prosemirror that works similarly google docs or word in suggestion-mode

Check out the live demos

ProseMirror Suggestion Mode Demo

Would love any feedback. I’d found a few old threads on this but they all seemed to have not resulted in a solution:

I also didn’t see any other plugins doing this (did I miss one?) so I wrote my own and thought I’d do so as a plugin and release it.

In that last thread @marjin suggests doing this with prosemirror-changeset. As mention in my Implementation Choices I went down that path and have a branch linked there but ran into issues (may have been understanding things wrong) when individual changes were approved/rejected.

2 Likes

Truly wild timing — @alexanderjulmer and I have been working on this exact problem for the past few weeks. We just published @handlewithcare/prosemirror-suggest-changes - npm, (GitHub - handlewithcarecollective/prosemirror-suggest-changes)!

It looks like we took a very similar approach! We opted for a “decorator” around dispatchTransaction, rather than appendTransactions, and made step handlers for the other step types as well.

If you’re interested in joining forces, I’d love to collaborate!

Whoa, that is wild timing! Will dive into checking yours out now.

For now, I came here to share some updates:

1.0.11

  • Fixed issue where suggestion marks were not being removed when deleting text inside them
  • Fixed issue where doing a delete one character from a suggestion_add was not working
  • Fully renamed to prosemirror-suggestion-mode from prosemirror-suggestions to avoid confusion with another lib
  • Made the hover menu extendable
  • Added a new example called inkAndSwitch which shows how to use the suggestion mode in a more complex example
  • fixed suggestEdit demo to show reason in hover menu

@SMores and @alexanderjulmer I went through your demo and some code yesterday. It is very similar! Would love to talk about collaborating. I’ve reached out to the hello@ email on your site. My email is my username here @gmail.

After talking with @SMores I realized several issues and limitations and largely did a full re-write. It now supports all step types, markup and utilizes prosemirror commands

Try the markdown demo here

1.0.21

Big rewrite here as the previous versions only supported the ReplaceStep and only for plain text.

Overall this release enables a lot more functionality while increasing simplicity, mostly by following better (more elegant) prosemirror practices

  • support all transaction step types - ReplaceStep, AddMarkStep, RemoveMarkStep, ReplaceAroundStep
  • replacing slices, not textContent - maintaining any markup in changes
  • all helper functions moved to be prosemirror commands
  • test cases for new step types and edge cases
  • ‘basic’ example using the prosemirror-example-setup with a toolbar, undo/redo and many formatting options
  • more proper use of prosemirror mark properties and functions like inclusive and
  • simplified the hover menu to a single decorator widget
  • integrated add/reject buttons into toolbar
  • paragraph pastes working
  • accept and reject suggestion commands are now range based
  • improved hover menus with option to disable

Just wanted to say thanks for this, great timing for my team as well :tada: