bluepeter / react-middle-ellipsis

Truncate a long string in the middle, instead of the end.
https://bluepeter.github.io/react-middle-ellipsis/
MIT License
63 stars 10 forks source link

Re-ellipse when size of container is adjusted (for whatever reason) #2

Open bluepeter opened 4 years ago

bluepeter commented 4 years ago

Right now, this component correctly re-ellipses when the browser is resized, using window.addEventListener("resize", () => { under the hood. However, when the surrounding table/etc is resized for some other reason, then the re-ellipse does not occur. For example, the surrounding container may resize due to XHR or other dynamic content.

We need to account for these sorts of resizes and re-compute widths and re-ellipse.

Possibly use https://github.com/ctrlplusb/react-sizeme or https://github.com/metalabdesign/react-resize-observer

theocerutti commented 3 years ago

Hello, bluepeter and thanks for this component! I know its a bit late, but I have this bug because I use AutoSize of react-virtualized...

Do you know how to workaround this problem ?

bluepeter commented 3 years ago

I don't, but I am happy to accept PRs :)

theocerutti commented 3 years ago

ok np, if I find a solution I will make a PR