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:
doc
{
content: 'block+',
}
text
{
group: 'inline',
inline: true,
}
paragraph
{
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, {
state,
dispatchTransaction(transaction) {
const newState = this.state.apply(transaction);
this.updateState(newState);
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? I understand the error description, but I don’t know what to do about it.