facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
19.9k stars 1.69k forks source link

Bug: TypeError: (0 , _lexical_table__WEBPACK_IMPORTED_MODULE_4__.getTableElement) is not a function - Missing getTableElement Export in Lexical Table Package #6831

Closed ALEXDINO7 closed 4 days ago

ALEXDINO7 commented 4 days ago

Description:

I'm using Next.js along with the Lexical Rich Text Editor. When attempting to use the TableCellResizer plugin from Lexical, I encounter the following error in the browser:

`Unhandled Runtime Error TypeError: (0 , _lexical_table__WEBPACK_IMPORTED_MODULE_4__.getTableElement) is not a function

Source app(lexical)\plugins\TableCellResizer\index.tsx (122:17) @ tableNode `

Error Details:

The issue occurs at the following line in my TableCellResizer plugin code:

const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey())); When I hover over getTableElement, I get the following message:

Module '"@lexical/table"' has no exported member 'getTableElement'.ts(2305)

Environment Lexical version:

"@lexical/react": "^0.20.0", "lexical": "^0.20.0", "next": "14.2.17", "prettier": "^2.3.2", "react": "^18", "react-dom": "^18", "react-error-boundary": "^3.1.4", "react-katex": "^3.0.1", "y-websocket": "^1.5.4",

code example: i used the code example from Lexical Playground

lexical 1 lexical 2 lexical 3

Steps to Reproduce:

  1. Install the Lexical rich text editor and set it up with Next.js.
  2. Add and configure the TableCellResizer plugin in your Lexical editor setup.
  3. Try interacting with the table cells, triggering the plugin’s functionality.
  4. Observe the browser console for the error.

Expected Behavior: The getTableElement function should be available for use, or the plugin should function without throwing an error related to its absence.

Actual Behavior: The getTableElement is not exported from the @lexical/table package, causing a TypeError when the TableCellResizer tries to use it.

etrepum commented 4 days ago

This is because you're mixing code from an unreleased version of lexical with the latest released version. You will have to install a nightly release or wait for the next one.