[Solved] Steps and collaborative editing

Have a nice day to everyone! I’m trying to implement collaborative editing. When I start typing in a new (empty) document, I get the following error:


My schema:

  content: 'block+',

  group: 'inline',
  inline: true,

  group: 'block',
  content: 'inline*',
  parseDOM: [{ tag: 'p.paragraph' }],
  toDOM: () => ['p', { class: 'paragraph' }, 0],

My code, which is responsible for sending changes to the server:
this.view = new EditorView(target, {

  dispatchTransaction(transaction) {
    const newState = this.state.apply(transaction);


    const sendable = sendableSteps(newState);

    if (sendable) {
      socketIO.emit('update', sendable.version, sendable.steps, sendable.clientID);

My code, which is responsible for getting changes from the server:
socketIO.on('updated', ([version, stepsJSON, clientIDs]) => {
  const steps = stepsJSON.map((json) => Step.fromJSON(schema, json));

  this.view.dispatch(receiveTransaction(this.view.state, steps, clientIDs)); 

From the server side, I simply resend the data that I receive from the client.

My package.json:

"prosemirror-collab": "1.3.1",
"prosemirror-model": "1.19.3",
"prosemirror-state": "1.4.3",
"prosemirror-transform": "1.7.5",
"prosemirror-view": "1.31.8",

What could be wrong? :face_with_peeking_eye: I understand the error description, but I don’t know what to do about it.

One possibility is that you’re mixing several Schema instances—even if they were defined the same way, you can’t put text from one schema into a paragraph from another.

1 Like

Damn! You’re absolutely right! Thank you, Marijn!