[lexical-playground] Feature: Add file attachment support with drag & drop functionality#7895
[lexical-playground] Feature: Add file attachment support with drag & drop functionality#7895Yjason-K wants to merge 0 commit intofacebook:mainfrom Yjason-K:main
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
File uploads encoded as base64 isn't really a very good idea. It's done for images just for demonstration purposes, but in order to support attachments (and images) in any real production capacity you would really need to have some server-side code or service provider (amazon s3, cloudflare r2, etc.) storing those files and the document should only store the URLs. My concern about adding more examples of what not to do will lead to more bad code in people's applications. |
|
@etrepum |
|
One useful primitive that I found when using Lexical for editing markdown blog pages on GitHub (and GitHub API)-backed site is:
Like so, content with attached images/files can be nicely edited in markdown and conversion markdown <> visual representation I named this "ImageRegistry" in my path, but maybe this concept could be fused into AttachmentStore Export/import of images/attachments with base64 contents can also be useful in some settings, e.g. for self-contained document representation. So having such explicit configurable support in export/import would also be useful. But I agree that in the most well-spread mode should be with URL's. |
Description
Current behavior:
Changes being added:
The implementation includes proper cleanup of object URLs, keyboard navigation support, and responsive styling that matches the playground theme.
Test plan
Before
After
File Upload Dialog:
Drag & Drop Functionality:
Attachment Display:
Serialization & Persistence:
Supported File Types:
E2E Test Coverage:
attachment.mov