Skip to content

RangeError: Unknown node type: tableParagraph #521

Closed

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)

Activity

  1. YousefED commented on Jan 17, 2024

    @YousefED
    Collaborator

    @barbudour the TipTapTransformer would need to know about the BlockNote node types that are added to prosemirror.
    We'd like to improve BlockNote's support for server-side handling. There is some related work going on here: #451 which you might be interested in.

    Curious what you're building btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions