xiaody / react-lines-ellipsis

Simple multiline ellipsis component for React.JS

Home Page:https://xiaody.github.io/react-lines-ellipsis/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug? - When the string does not contain spaces it is not clamped

creddy opened this issue · comments

It could be that I'm using the component incorrect. Please correct me if I am.

This is an edge case for sure, but if the string does not contain any spaces it doesn't appear to be clamped.

From the demo

screen shot 2018-10-26 at 5 44 00 pm

You may need to set props.basedOn='letters' for such case.

@xiaody Thank you for the quick reply 😄

I attempted setting both letters and words but I am seeing the same issue

And also you need to add style overflow-wrap: break-word; for the element since the demo sets white-space: pre-wrap; on it.

react-lines-ellipsis only clamps lines, not width. So you need to tell the browser to wrap the line.

same question, even add style overflow-wrap: break-word;

image
after add overflow-wrap: break-word

@xiaody Facing same issue and even adding style overflow-wrap: break-word; did not work

@xiaody is this problem under evaluation? We are facing the same problem, when there's only one word that does not contain spaces

@xiaody is this problem under evaluation? We are facing the same problem, when there's only one word that does not contain spaces

As I have said, this is not a bug IMO. Users need to correctly set the props and style for such cases.
Here is a demo https://codesandbox.io/s/zzx438p7l4.

Check the comments in #45 if you're facing the same problem.