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

Feature: Scroll for table #6480

Closed
denindka opened this issue Jul 31, 2024 · 18 comments · Fixed by #6759
Closed

Feature: Scroll for table #6480

denindka opened this issue Jul 31, 2024 · 18 comments · Fixed by #6759
Labels
enhancement Improvement over existing feature

Comments

@denindka
Copy link

denindka commented Jul 31, 2024

Description

It would be great if the table had its own scroll bar. Right now, the scroll affects the entire document, which is not very convenient.
The video shows an example of how this is implemented in other projects.

Screen.Recording.2024-07-31.at.12.44.41.mov
@denindka denindka added the enhancement Improvement over existing feature label Jul 31, 2024
@keiseiTi
Copy link
Contributor

I tried to solve this problem, but the createDOM method of ElementNode does not support nested elements
image

@keiseiTi
Copy link
Contributor

Can ElementNode add a method createDOMContainer to create a DOM container that wraps the DOM ? @zurfyx

@agscripter
Copy link

Hey, It would be great to have this feature. +1

@lxzmo
Copy link

lxzmo commented Aug 2, 2024

+1

1 similar comment
@bilobom
Copy link

bilobom commented Aug 5, 2024

+1

@alphaCastor
Copy link

alphaCastor commented Aug 9, 2024

As quick workaround (before we will have nested elements support) you can use css:

table {
  max-width: 100%;
  overflow: auto;
  display: block;
}

And keep in mind that whole editor container must have width

UPD. Change columns size wont work :(

@CojocaruCristi
Copy link

@CojocaruCristi
Copy link

+++++++

@MaslovRustislav
Copy link

Fell into the same issue, please help!

@yaojiu19
Copy link

I am trying to solve it by customElements, but were some issues. pr: #6587

@GermanJablo
Copy link
Contributor

Thanks to @yaojiu19 for offering to contribute to this issue, although that PR doesn't solve the problem in "the lexical way" as the maintainers mentioned there.

I'm willing to solve this issue myself, but first I'd like to know if the Lexical team thinks it's ok to introduce a new ElementNode that acts as a wrapper.

@etrepum
Copy link
Collaborator

etrepum commented Sep 27, 2024

@GermanJablo The biggest problems with #6587 are that there are exactly zero lines of tests, documentation or examples. There's no way to know whether it works at all other than to fill in all the missing pieces. Does it say it solves a problem? Sure. Does it actually? Does it break anything for people who are using custom nodes with however Lexical interacts with them today? Who knows. Can't possibly approve it in its current state.

Custom elements aren't used or tested anywhere else in Lexical, and that it's unclear there wouldn't be other problems with this approach (regarding selection, events, or anything else). A different approach that did not add custom elements was in #5930 / #5981 but that also stalled in part because you questioned what utility it would have, so it too is missing all of the finishing work that would have to be done before anyone knows if it is a real solution or not.

@GermanJablo
Copy link
Contributor

I don’t see why I would be responsible for PR 5930 being stalled. If that's the case for some reason, I encourage anyone who wants to continue it :)

As far as this issue is concerned, what I am suggesting is adding a new ElementNode, which seems to me to be the simplest solution.

@etrepum
Copy link
Collaborator

etrepum commented Sep 28, 2024

I'm sure the large part that it's just a hard problem to solve, but your feedback on that PR was the only negative feedback and may have contributed to them losing steam. Adding a new kind of ElementNode that has components that are otherwise "invisible" to the reconciler is more or less equivalent to having a DecoratorElementNode, so going back to that PR and looking more closely might be worth your time. Note that any decorator can render all of its children directly in createDOM/updateDOM and return null from its decorate method if there isn't a need for a framework managed portal. I look forward to seeing what you come up with!

@GermanJablo
Copy link
Contributor

I have opened a PR that closes this issue: #6713.
Comments and observations are welcome.

@agscripter
Copy link

Hi @GermanJablo, great job, I love this feature.

Do you believe it's possible to have a table inside the document that its width is larger than the document and the table can be shown like in Quip:

Screenshot 2024-10-17 at 8 11 00 AM

As you can see, the table width is larger than the document content, but still the table is shown without the horizontal scroll.
Perhaps with your implementation it's possible to achieve this result as well.

@GermanJablo
Copy link
Contributor

Thanks @agscripter. Yes, that should be possible by playing with the paddings

@yaojiu19
Copy link

yaojiu19 commented Oct 18, 2024

now I implement it through plugins
PixPin_2024-10-18_09-11-39

create a scrollbar outside the editor by watch the width of root element and the table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement over existing feature
Projects
None yet