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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

'header' param no longer sets all rows as headers in 'insertTable' #3131

Open
redgeparamify opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@redgeparamify
Copy link

redgeparamify commented Apr 18, 2024

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @udecode/plate-table@30.9.1 for the project I'm working on.

Our team was seeing a bug when creating tables where the header param would set all rows in the new table to header. The small tweak below fixed the problem for us.

Here is the diff that solved my problem:

node_modules/@udecode/plate-table/dist/index.mjs
var getEmptyTableNode = (editor, {
   colCount,
   newCellChildren
 } = {}) => {
-  const rows = Array.from({ length: rowCount }).fill(rowCount).map(() => getEmptyRowNode(editor, { header, colCount, newCellChildren }));
+  const rows = Array.from({ length: rowCount }).fill(rowCount).map((_, index) => getEmptyRowNode(editor, { header: index === 0 && header, colCount, newCellChildren }));
   return {
     type: getPluginType3(editor, ELEMENT_TABLE),
     children: rows

This issue body was partially generated by patch-package.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant