Comments (2)
One approach is to extract the Dropzone functionality from the editor but ideally it is part of the editor state since the shared state simplifies managing the attached files.
I would advise you to do this outside of the editor if you don't care about the position of this attachment within a document. The tradeoffs of trying to shoehorn this into the editor state model are just not worth it (imo) if all you need is to attach some images to the document.
from lexical.
One approach is to extract the Dropzone functionality from the editor but ideally it is part of the editor state since the shared state simplifies managing the attached files.
I would advise you to do this outside of the editor if you don't care about the position of this attachment within a document. The tradeoffs of trying to shoehorn this into the editor state model are just not worth it (imo) if all you need is to attach some images to the document.
I ended up following your advise. I feel like it is a compromise to keep the Dropzone functionality non-integrated since I have to manage the state for file uploads separately from everything else. It works well though so I'm somewhat satisfied.
Here is what I ended up doing for anyone who wants to implement similar functionality:
- A custom
DropzonePlugin
component that is responsible for: 1) drag / drop event handling; 2) Rendering aDropzoneArea
UI; 3) Rendering thumbnail previews of uploaded images. - Object URLs for selected files are stored in Redux state. This allows me to append files from sources other than the Dropzone (e.g.
FileUploadButton
in the toolbar).
Would appreciate your feedback on this approach @acywatson - for myself and future readers
from lexical.
Related Issues (20)
- Bug: Additional paragraph inserted when pressing "Enter" within AutoLinkNode
- Bug: Not able to use ColorPicker inside FloatingToolbar
- Feature: File upload HOT 1
- Bug: Links don't follow Link style if text formatting is applied
- Bug: Missing semicolon error when I run npm start on second time of the cloned repo HOT 2
- Bug: Table is not deleted correctly when selected by shift + arrowup HOT 2
- Docs: Replace lingering references of GridSelection with TableSelection
- Bug: @lexical/react 0.14.4 brings in @lexical/devtools-core dependency without declaring it HOT 6
- Bug: Collapsible container is not properly deserialized HOT 6
- Docs: Add FAQs about hot module reloading HOT 1
- Bug: API modules list HOT 1
- Docs: Generate docusaurus sidebars from filesystem
- Bug: private module 'shared' is referenced in shipped type declarations HOT 1
- Feature: Use api-extractor when generating the .d.ts files for distribution HOT 4
- Feature: escape key handler for plain text plugin
- TODO: Add a test for mouse leaving browser window during table selection HOT 1
- Proposal: DecoratorElementNode HOT 10
- Bug: (Firefox) Caret disappears after dragging a block HOT 2
- Bug: Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update() or editorState.read(). HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lexical.