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

Very long text breaks if the Text is longer than the Viewport #60

Open
anderle opened this issue Mar 26, 2021 · 0 comments
Open

Very long text breaks if the Text is longer than the Viewport #60

anderle opened this issue Mar 26, 2021 · 0 comments

Comments

@anderle
Copy link

anderle commented Mar 26, 2021

Hey, there you should set the style property whiteSpace to "nowrap",
otherwise the Block for very long texts breaks after the Viewport width.

// Determines size of text within the document given certain style properties

sizeForText : function(textValue, properties) {
// Using a here may not be the best approach. In theory a user's stylesheet
// could override the necessary styling for determining sizes below. With growing
// support for custom tags in html, we may consider using them if this raises problems.
var el = document.createElement("span"),
size;

properties = this.ensurePropertyValues(properties);

el.innerHTML = textValue;
el.style.display = "inline-block";
el.style.fontFamily = properties.family;
el.style.fontSize = properties.size + "px";
el.style.fontWeight = properties.weight;
el.style.fontStyle = properties.style;
el.style.lineHeight = properties.leading;
el.style.maxWidth = "none";
el.style.padding = this.stringifiedPadding(properties);
el.style.position = "absolute";
el.style.width = "auto";
el.style.visibility = "hidden";
el.style.whiteSpace = "nowrap";

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

No branches or pull requests

1 participant