tldraw / tldraw-v1

A tiny little drawing app. This is the original 2021-2022 version, released under MIT.
https://old.tldraw.com
MIT License
61 stars 36 forks source link

[bug] Newlines in text boxes are not properly exported #89

Closed MaxAtoms closed 8 months ago

MaxAtoms commented 1 year ago

Steps to reproduce

  1. Create a text box with multiple lines
  2. Export the image (the problem appears at least with SVG and PNG exports)

Expected result

The exported image looks exactly like the drawing in the web UI.

Actual result

New lines are missing so that the text is misplaced. For small images the text may not fully appear on the exported image.

Additional information

The newlines are properly saved within .tldr files.

Minimal example

Web UI

newline-export-bug-ui

Exported image

newline-export-bug

tldr save file

{"name":"New Document","fileHandle":null,"document":{"id":"doc","name":"New Document","version":15.5,"pages":{"page":{"id":"page","name":"Page 1","childIndex":1,"shapes":{"d5b2d882-eecf-4ac2-0bbf-6ce1d3b2d3a1":{"id":"d5b2d882-eecf-4ac2-0bbf-6ce1d3b2d3a1","type":"text","name":"Text","parentId":"page","childIndex":1,"point":[890.5,343.86],"rotation":0,"text":"This\nis\na\nminimal repro\nof the\nexport bug","style":{"color":"lightGray","size":"small","isFilled":false,"dash":"draw","scale":1.1925925925925926,"font":"script","textAlign":"middle"}}},"bindings":{}}},"pageStates":{"page":{"id":"page","selectedIds":[],"camera":{"point":[0,0],"zoom":1}}},"assets":{}},"assets":{}}
MaxAtoms commented 1 year ago

Addendum: It seems to only happen for lines that contain a single word. Longer lines are fine.

steveruizok commented 1 year ago

Interesting! Thanks for the report.

varungandhi-src commented 1 year ago

Potentially related, it looks like trailing indentation is being dropped as well (at least, when using left alignment + spaces for indentation).

image

Export output:

Page 5(2)

StriveTeam commented 1 year ago

Now I had the same problem in v1, how can i do it?? @TodePond