Skip to content

Long URLs and unbroken text overflow fixed-width text boxes #25

Open

Description

@aakashbarbhaya

FYI: The description and suggested approach below were provided by AI.

Description

In @quickdrawjs/core@0.2.0, long URLs or strings without spaces can overflow fixed-width text boxes instead of wrapping within the available width.

We encountered this while embedding Quickdraw in a prescription editor, where pasted text needs to stay within the printable area.

Steps to reproduce

  1. Create a text shape with autosize: false and width 200.
  2. Set its text to:
    https://example.com/abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
    
  3. Finish editing and inspect the rendered text.

Expected behavior

Text wraps within the available width, including when a single word or URL exceeds that width. Wrapping should remain consistent between inline editing, canvas rendering, and image export.

Actual behavior

The oversized token remains on one line and extends beyond the text box.

Possible cause

In packages/core/src/shapes.js, wrapLines() wraps at whitespace boundaries but doesn't split an individual token that exceeds maxW.

Implementation reference

We're using a small local patch that splits oversized lines into smaller measured segments. This addresses our immediate use case; we can share it if helpful.

A general fix should also preserve emoji and combining-character sequences when choosing line breaks, and leave autosized text unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions