Skip to content

Allow pasting SVG XML code directly into the editor and render via Image block (if valid) #259

@jeffpaul

Description

@jeffpaul

Is your enhancement related to a problem? Please describe.

Introduce functionality that lets users paste raw SVG XML code into the editor. If the SVG passes Safe SVG’s sanitization process, it should render inline just like an uploaded SVG file. If it fails sanitization, show a clear error message explaining why the SVG was rejected.

This enables a faster authoring workflow, especially for users copying SVGs directly from design tools or icon libraries. It removes the extra step of needing to save and upload a file. It also benefits developers working in staging environments or prototyping designs quickly.

Designs

  • Use Safe SVG’s existing sanitization pipeline to validate pasted XML before rendering.
  • Provide inline error handling if the SVG is malformed or flagged as unsafe.
  • Consider extending the Media Library experience to support copy-paste for SVG uploads.
  • Ensure accessibility and security best practices are preserved (e.g., stripping scripts, enforcing viewBox, etc.)

Describe alternatives you've considered

Note that this comes from feedback in https://x.com/alexmansfield/status/1930381336428327344 && https://x.com/alexmansfield/status/1932200335147425954.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions