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

Fix compute cell indices, table unmerge, delete row / column, add row / column, copy table data #3552

Merged
merged 6 commits into from
Sep 20, 2024

Conversation

natamox
Copy link
Collaborator

@natamox natamox commented Sep 19, 2024

Problems encountered in the table now:
When splitting cells, deleting and adding rows and columns, the table format will be disordered and cells will be missing. In the end, I found that all the errors are related to a function (computeAllCellIndices). Because the result of this function is wrong, the subsequent process goes in the wrong direction, and the splitting, adding and deleting all lack consideration for certain special situations, which leads to errors.
Solution:

  1. Remove computeAllCellIndices and replace it with computeCellIndices with a more accurate algorithm
  2. Split cells and use the function getClosestColPathForRow to obtain a more accurate path to adjacent cells
  3. For table data copied and pasted, make the colspan and rowspan attributes in the html tag compatible
  4. Insert rows, insert columns, and delete columns fix the exceptions caused by inaccurate calculations of colspan and rowspan, and use deep copy cells to prevent impact on previous data
  5. The situation of deleting rows is relatively complicated. In addition to the same problem as the fourth one mentioned above, the previous processing of moveToNextRowCells was relatively simple, without considering special cases, and incorrect calculation of rowsNumberAffected
  6. Fix the exceptions caused by no filtering of data and path calculation errors when copying and pasting table data

Copy link

codesandbox bot commented Sep 19, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 7:21am

Copy link

changeset-bot bot commented Sep 19, 2024

🦋 Changeset detected

Latest commit: 44544cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@udecode/plate-table Patch
@udecode/plate-csv Patch
@udecode/plate-docx Patch
@udecode/plate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@natamox natamox changed the title Fix unmerge & compute cell indices Fix unmerge, compute cell indices, delete row / column, add row / column Sep 20, 2024
@zbeyens zbeyens merged commit 2ab6b6b into main Sep 20, 2024
8 checks passed
@zbeyens zbeyens deleted the fix/table-unmerge branch September 20, 2024 08:08
@zbeyens
Copy link
Member

zbeyens commented Sep 20, 2024

Great job @natamox , thanks!

@natamox natamox changed the title Fix unmerge, compute cell indices, delete row / column, add row / column Fix table unmerge / merge, compute cell indices, delete row / column, add row / column Jan 16, 2025
@natamox natamox changed the title Fix table unmerge / merge, compute cell indices, delete row / column, add row / column Fix table unmerge, compute cell indices, delete row / column, add row / column Jan 16, 2025
@natamox natamox changed the title Fix table unmerge, compute cell indices, delete row / column, add row / column Fix compute cell indices, table unmerge, delete row / column, add row / column Jan 16, 2025
@natamox natamox changed the title Fix compute cell indices, table unmerge, delete row / column, add row / column Fix compute cell indices, table unmerge, delete row / column, add row / column, copy table data Jan 16, 2025
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

Successfully merging this pull request may close these issues.

2 participants