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

Incorrect text wrapping position #2696

Closed
GOGOGOSIR opened this issue Sep 8, 2021 · 9 comments · Fixed by #2782
Closed

Incorrect text wrapping position #2696

GOGOGOSIR opened this issue Sep 8, 2021 · 9 comments · Fixed by #2782

Comments

@GOGOGOSIR
Copy link

describe:

When the text exceeds one line, the position of the text in the generated picture is out of order

Bug reports:

Rendered dom:
issue2
dom to image by html2canvas:
issue1

Specifications:

  • html2canvas version tested with: v1.3.2
  • Browser & version: safari
  • Operating system: ios 13.6.1
@jiaotadie
Copy link

同样问题,请问你是如何解决的

@Tiacx
Copy link

Tiacx commented Sep 14, 2021

#2648
If i change version to 1.0.0 everything works as expected

如上所述,使用 1.0.0 版本问题就解决了~
https://github.com/niklasvh/html2canvas/releases/tag/v1.0.0

@Tiacx
Copy link

Tiacx commented Sep 14, 2021

用 1.0.0 版本还是有其他问题,脑壳疼(-。-;。

@wwh1248
Copy link

wwh1248 commented Sep 17, 2021

我用1.0.0直接空白了,换了好多版本,多多少少都有问题

@Tiacx
Copy link

Tiacx commented Sep 17, 2021

我用1.0.0直接空白了,换了好多版本,多多少少都有问题

我暂时换了 dom-to-image,不过也有其他问题

@wwh1248
Copy link

wwh1248 commented Sep 18, 2021

我用1.0.0直接空白了,换了好多版本,多多少少都有问题

我暂时换了 dom-to-image,不过也有其他问题

我在issue中看见了这样一个解决方案,每个字符都加上span标签,亲测有效

@Lrdcq
Copy link

Lrdcq commented Oct 7, 2021

After debugging, I found that the bug is in this file https://github.com/niklasvh/html2canvas/blob/master/src/css/layout/bounds.ts
In Safari, the first character after the first line behaves strangely.
QQ20211007-163630
When measure it, getClientRects() return two DOMRect and the first is empty and incorrect (It's on the end of last line).

But bounds.ts now just take the first DOMRect....
QQ20211007-163715

@pxmage
Copy link

pxmage commented Oct 13, 2021

After debugging, I found that the bug is in this file https://github.com/niklasvh/html2canvas/blob/master/src/css/layout/bounds.ts In Safari, the first character after the first line behaves strangely. QQ20211007-163630 When measure it, getClientRects() return two DOMRect and the first is empty and incorrect (It's on the end of last line).

But bounds.ts now just take the first DOMRect.... QQ20211007-163715

Thank you! You just saved my day!

I'll build a tweaked version for my own use, and waiting for the fix.

Here is how I tweak it:
Screen Shot 2021-10-13 at 6 41 29 PM

vissera added a commit to jibecompany/html2canvas that referenced this issue Nov 2, 2021
@Mrmantou
Copy link

Mrmantou commented Dec 9, 2021

After debugging, I found that the bug is in this file https://github.com/niklasvh/html2canvas/blob/master/src/css/layout/bounds.ts In Safari, the first character after the first line behaves strangely. QQ20211007-163630 When measure it, getClientRects() return two DOMRect and the first is empty and incorrect (It's on the end of last line).
But bounds.ts now just take the first DOMRect.... QQ20211007-163715

Thank you! You just saved my day!

I'll build a tweaked version for my own use, and waiting for the fix.

Here is how I tweak it: Screen Shot 2021-10-13 at 6 41 29 PM

Thanks, you saved my life

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

Successfully merging a pull request may close this issue.

7 participants