Skip to content

Latest commit

 

History

History

suggested-changes

Suggested Changes

Extension of websocket-prosemirror-blocks that adds "Suggested Changes".

Select some text and click "Suggest change" to create a suggestion on the right side. Edit it and accept/reject.

Internally, each suggestion (class Suggestion) first copies the selected portion of the main text into a new ProseMirrorWrapper. Edits to the suggestion are tracked as Messages, then committed to the main text if accepted - as if performed by a collaborator. Suggestions also update live to reflect their merge with the main text, via src/site/main.ts's onLocalChange function.

Code organization:

  • src/common/: Messages shared between clients and the server.
  • src/server/: WebSocket server.
  • src/site/: ProseMirror client.
    • src/site/suggestion.ts: Class managing the GUI and state for an individual suggestion.

Future Plans

  • Make suggestions collaborative.
  • Show where suggestions are with a highlight in the main text. Increase highlight on the focused suggestion.
  • Formatting in suggestions - currently only keyboard shortcuts (Ctrl+I/B) are supported.
  • Testing/cleanup.

Installation

First, install Node.js. Then run npm i.

Commands

npm run dev

Build the app from src/, in development mode.

npm run build

Build the app from src/, in production mode.

npm start

Run the server on http://localhost:3000/. Use multiple browser windows at once to test collaboration.

To change the port, set the $PORT environment variable.

npm run clean

Delete dist/.