Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TypeError: Cannot read properties of undefined (reading 'addExtensions') #6084

Open
1 task done
leo-paz opened this issue Feb 4, 2025 · 0 comments
Open
1 task done
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@leo-paz
Copy link

leo-paz commented Feb 4, 2025

Affected Packages

core, html, extension-table, extension-document

Version(s)

2.11.5

Bug Description

My code:

/components/tiptap-editor/extensions/table.tsx

import TiptapTable from "@tiptap/extension-table"

export const Table = TiptapTable.configure({ resizable: true, lastColumnResizable: false })

export default Table
import {  
  Table,
  TableCell,
  TableHeader,
  TableRow,
  Paragraph,
  Document, 
} from "@/components/tiptap-editor/extensions"
import { Document as TiptapDocument } from "@tiptap/extension-document"
export const Document = TiptapDocument.extend({
  content: "(block|columns)+",
  addExtensions() {
    return [Table]
  },
})
case DOCUMENT_BLOCK_TYPES.TABLE: {
    const json = generateJSON(block.content, [
        Document,
        Table,
        TableCell,
        TableHeader,
        TableRow,
        Paragraph,
      ])
}

And I get this error consistently:
TypeError: Cannot read properties of undefined (reading 'addExtensions')
at Array.map ()
at Array.map ()
at block (lib/parse-document/block-mapping.ts:101:32)
at block (lib/parse-document/document-validation.ts:137:67)
at Array.map ()
at map (lib/parse-document/document-validation.ts:137:27)
at async parse (lib/parse-document/parse.ts:118:57)
at async handler (webpack-internal:/(rsc)/app/api/document/parse/app/api/document/parse/route.ts:72:25)
99 |
100 | case DOCUMENT_BLOCK_TYPES.TABLE: {

101 | const json = generateJSON(block.content, [Document, Table])

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

I would just like this to output json for a table.

Additional Context (Optional)

I have tried importing like mentioned in this issue with no luck: #1580

Dependency Updates

  • Yes, I've updated all my dependencies.
@leo-paz leo-paz added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant