Skip to content

Conversation

@caio-pizzol
Copy link
Contributor

This commit introduces a new import feature that allows users to upload .docx files. It includes UI updates for the import button and error handling for invalid file types. The toolbar now displays an error message if the import fails, enhancing user experience.

This commit introduces a new import feature that allows users to upload .docx files. It includes UI updates for the import button and error handling for invalid file types. The toolbar now displays an error message if the import fails, enhancing user experience.
@linear
Copy link

linear bot commented Oct 9, 2025

SD-549 Add file upload UI for importing external .docx files into template builder

Summary

Add a file upload button to allow users to import external .docx files into the template builder editor.

Tasks

  • Add a file input component (hidden) and a styled "Import File" button to the toolbar
  • Handle file selection and validation (ensure .docx format, reasonable file size)
  • Pass the selected File object to the document.source prop which SuperDoc already supports
  • Add basic error handling for invalid files or load failures
  • Add visual feedback during file loading (loading state on button)

Notes

Current State:

  • SuperDoc already accepts File/Blob/string for document.source - infrastructure is ready
  • Template builder passes this through: document: document?.source

Implementation Approach:

  • Keep it minimal: just a button + file input, no drag-drop or advanced features initially
  • File validation: check extension (.docx) and size (< 10MB reasonable limit)
  • No file preview needed initially - user sees the document once loaded in editor
  • Loading state: disable button and show spinner while file loads

Reference:

API Already Supports:

new SuperDoc({
  selector: '#editor',
  document: docxFile  // File, Blob, or URL
});

This is a simple UI addition - all the heavy lifting is already done by SuperDoc.

@caio-pizzol caio-pizzol enabled auto-merge (squash) October 9, 2025 20:22
@caio-pizzol caio-pizzol merged commit 42faccc into main Oct 9, 2025
2 checks passed
@caio-pizzol caio-pizzol deleted the caio/sd-549-add-file-upload-ui-for-importing-external-docx-files-into branch October 9, 2025 20:22
@superdoc-bot
Copy link

superdoc-bot bot commented Oct 9, 2025

🎉 This PR is included in version 0.2.0-next.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

superdoc-bot bot pushed a commit that referenced this pull request Nov 13, 2025
# [0.2.0](v0.1.0...v0.2.0) (2025-11-13)

### Bug Fixes

* force pre-release ([f752754](f752754))
* improve cleanup logic ([#11](#11)) ([01f0bf9](01f0bf9))
* update field ID type and improve field handling ([#14](#14)) ([e0e6d31](e0e6d31))
* update field IDs and categories in README and App component ([61a473d](61a473d))

### Features

* add import functionality for .docx files in the template builder ([#15](#15)) ([42faccc](42faccc))
* enhance exportTemplate functionality with configurable options ([#17](#17)) ([7e2a03d](7e2a03d))
* enhance field handling with mode support in template builder ([#16](#16)) ([d46ab5d](d46ab5d))
* implement viewport clamping for menu positioning in SuperDocTemplateBuilder ([#10](#10)) ([09e82ee](09e82ee))
@superdoc-bot
Copy link

superdoc-bot bot commented Nov 13, 2025

🎉 This PR is included in version 0.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants