Skip to content

RangeError: Unknown node type: tableParagraph #521

Closed
@barbudour

Description

@barbudour

Describe the bug
I'm trying to set up BlockNote Collaboration using Hocuspocus and the Database extension. When saving the data to the database everything works fine, but when retrieving the data and converting it to a Y.Doc (I'm using TiptapTransformer.toYdoc from @hocuspocus/transformer) I get a format error RangeError: Unknown node type: tableParagraph. As I understand - when parsing data, the handler encounters an unfamiliar data format. Perhaps someone has encountered this problem, how to pass to TiptapTransformer.toYdoc the data types that BlockNote works with so that it processes the data correctly?

The code of my handler is inside Database extension:

import {TiptapTransformer} from "@hocuspocus/transformer"
import {StarterKit} from "@tiptap/starter-kit";

const emptyDoc = new Y.Doc({
    guid: data?.id
})
if (data && data.document) {
    try {
        const doc = TiptapTransformer.toYdoc(data.document, 'default', [StarterKit])
        resolve(Y.encodeStateAsUpdate(doc))
    } catch (e) {
        // console.log(data.document)
        console.log(e)
        resolve(Y.encodeStateAsUpdate(emptyDoc))
    }
} else {
    resolve(Y.encodeStateAsUpdate(emptyDoc))
}

Terminal output:

[2024-01-16T18:49:33.411Z] Loaded document "5d3b0499-4644-4513-b60d-73c31561ba82".
RangeError: Unknown node type: tableParagraph
    at Schema.nodeType (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1950:25)
    at Function.fromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1172:21)
    at Schema.nodeFromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1939:19)
    at Array.map (<anonymous>)
    at Function.fromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:288:33)
    at Function.fromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1171:30)
    at Schema.nodeFromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1939:19)
    at Array.map (<anonymous>)
    at Function.fromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:288:33)
    at Function.fromJSON (/Users/barbudour/AI/socket/node_modules/prosemirror-model/dist/index.cjs:1171:30)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions