Skip to content

fix(export): normalize elements before export to preserve text - #51

Open
breadoncee wants to merge 1 commit into
excalidraw:mainfrom
breadoncee:fix/export-text-elements
Open

breadoncee wants to merge 1 commit into
excalidraw:mainfrom
breadoncee:fix/export-text-elements

Conversation

@breadoncee

@breadoncee breadoncee commented Mar 20, 2026 •

Copy link
Copy Markdown
excalidraw_export_text_bug.mp4

Summary

  • Fix export_to_excalidraw silently dropping all text elements when opening diagrams on excalidraw.com
  • Call restore({ refreshDimensions: true }) before serializeAsJSON in shareToExcalidraw to ensure text elements have all required fields (rawText, originalText, width, height, lineHeight, autoResize, containerId, etc.)

Root Cause

Elements in the inline view pass through convertToExcalidrawElements but not restore(), leaving text elements without fields that excalidraw.com requires. The fullscreen editor path already called restore() on mount, so only inline exports were affected.

Test plan

  • Build passes (npm run build)
  • Type check passes (tsc --noEmit)
  • In Claude Desktop: create a diagram with labeled shapes and arrows, click "Open in Excalidraw", verify all text labels appear on excalidraw.com

Fixes #22

Text elements exported via "Open in Excalidraw" were silently dropped
by excalidraw.com because they were missing required fields (rawText,
originalText, width, height, lineHeight, autoResize, etc.).

Call restore({ refreshDimensions: true }) before serializeAsJSON to
ensure all element fields are fully populated.

Fixes excalidraw#22
@vercel

vercel Bot commented Mar 20, 2026

Copy link
Copy Markdown

@breadoncee is attempting to deploy a commit to the Excalidraw Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

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

Labels

None yet

1 participant