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

Feat: table splitting #52

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

azriel46d
Copy link

@azriel46d azriel46d commented Jan 22, 2025

This PR addresses basic table splitting. see #43

Future improvements

  • split rows where cells which are larger than a whole page.

Note the table attributes need to be extended to support groupId

export default Table.extend({
  content: 'tableRow*',

  addOptions() {
    return {
      ...this.parent?.(),
      View: CustomTableView as any,
    }
  },

  addAttributes() {
    return {
      ...this.parent?.(),
      id: {
        default: null,
      },
      groupId: {
        default: null,
      },
    }
  }

Video is as part of umo-editor

table-splitting.mov

@hugs7 hugs7 self-assigned this Jan 26, 2025
@hugs7 hugs7 self-requested a review January 26, 2025 01:33
@hugs7 hugs7 added the enhancement New feature or request label Jan 26, 2025
@hugs7 hugs7 linked an issue Jan 26, 2025 that may be closed by this pull request
Copy link
Owner

@hugs7 hugs7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting the time into this. I'll be honest - I haven't actually tested your code to see if it works yet.

I'd like you to fix up where I've added comments, then I'd be happy to give it a test.
Let me know if you have any questions.

@@ -73,4 +73,4 @@ const PaginationPlugin = new Plugin({
},
});

export default PaginationPlugin;
export default PaginationPlugin;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a trailing blank line here.
Get prettier if you are using vscode

@@ -819,4 +934,4 @@ export const paginationUpdateCursorPosition = (tr: Transaction, newCursorPos: Nu
} else {
setSelectionAtEndOfDocument(tr);
}
};
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank line here required

@azriel46d
Copy link
Author

Thanks for this thorough review.
Totally understand on comments. At the end of the day it is your repository so it needs to fit with what you deem fit .

Can you kindly share your .prettierc config. As i had to disable prettier due to a different configuration which was reformatting the whole file.

@hugs7
Copy link
Owner

hugs7 commented Jan 27, 2025

Sure gimme a moment to make one.

@hugs7
Copy link
Owner

hugs7 commented Jan 27, 2025

Okay I've pushed a .prettierrc config file. I think you should be able to rebase a fork. Here's a link from a quick Google search
https://medium.com/@topspinj/how-to-git-rebase-into-a-forked-repo-c9f05e821c8a

@azriel46d azriel46d force-pushed the feature/table-splitting branch from 4dba4e4 to ce22674 Compare January 27, 2025 09:24
@azriel46d
Copy link
Author

azriel46d commented Jan 27, 2025

All raised issues should be resolved.

@hugs7
Copy link
Owner

hugs7 commented Jan 28, 2025

Great. I'll try to test it now
I will admit I haven't played much with tables in Tiptap so it might take me a bit to get a test environment working

@azriel46d
Copy link
Author

azriel46d commented Jan 28, 2025 via email

@hugs7
Copy link
Owner

hugs7 commented Jan 28, 2025

Out of time for me tonight. I'll try again tomorrow.

Oh I'll definitely add your work in - it's clear you've put a bit of time into it

@zhuyihe
Copy link

zhuyihe commented Feb 6, 2025

@azriel46d Thank you for your efforts! I know the author of umo. In addition, the paging function was made by another person. Now the paging person has no time to support the umo editor, which leads to more bugs in actual application. Therefore, the paging function was deleted in the v5 version and moved to the break-v4 branch. In addition, I have a little question, can your current table paging extension be able to cut cells? After all, once the cells are too large, they will leave a lot of blank space.

@azriel46d
Copy link
Author

azriel46d commented Feb 7, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hope it can support table pagination
3 participants