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

  entity is not preventing line break #36

Open
girlboss-energy opened this issue Jul 12, 2022 · 3 comments
Open

  entity is not preventing line break #36

girlboss-energy opened this issue Jul 12, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@girlboss-energy
Copy link

Version: 1.1.8

&nbsp entity seems to be correctly replaced by space but the non breaking functionality is not working. Here is my test code:

          <Document style={{ fontFamily: 'Roboto' }}>
            <Page style={{ padding: 15 }}>
              <Html style={{ fontSize: 13 }}>
                {`tets text: Lorem ipsum dolor sit amet,
                consectetur adipiscing elit. Cras eget ultricies lacus. Quisque
                dignissim purus nibh, ac efficitur justo aliquet id. Quisque
                magna magna, placerat non venenatis vel, volutpat ac libero.
                Etiam sit amet diam facilisis, posuere enim nec, eleifend ex ex.
                Phasellus&nbsp;NOBREAK scelerisque, sapien quis ullamcorper tincidunt,
                elit metus maximus augue, eu luctus nunc sem a nisl. Vestibulum
                bibendum ornare mauris sed accumsan. Phasellus&nbsp;NOBREAK non
                finibus est. Vivamus aliquet nulla et orci euismod, non molestie
                felis semper. Aenean lacinia tellus sem, quis tincidunt leo
                pharetra non. Cras consequat nulla et tellus porttitor dictum.
                Fusce leo elit, ultrices eget volutpat nec, fermentum ut mi.
                Aliquam ultricies euismod tortor, et rhoncus diam maximus in.
                Cras convallis hendrerit feugiat. Vestibulum a euismod est, sed
                dignissim ipsum. Etiam maximus nisi risus, sit amet commodo
                libero viverra a. Suspendisse mattis tellus vitae leo viverra
                egestas.`}
              </Html>
            </Page>
          </Document>

and here's how it renders:

image

@danomatic
Copy link
Owner

@MagicalPrincess I don't think &nbsp; prevents text wrapping. It just prevents the browser from collapsing multiple spaces into a single space

@danomatic
Copy link
Owner

@MagicalPrincess my mistake. I didn't realize that it was supposed to prevent line breaks as well. In all my years doing web dev I've never used it for that!

@danomatic
Copy link
Owner

That being said. I'm not sure if there's a way with react-pdf to achieve this, but I'll think about it

@danomatic danomatic added enhancement New feature or request help wanted Extra attention is needed labels Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants