GithubHelp home page GithubHelp logo

Slack Dropzone Plugin about lexical HOT 2 OPEN

hazirmagron avatar hazirmagron commented on May 2, 2024
Slack Dropzone Plugin

from lexical.

Comments (2)

acywatson avatar acywatson commented on May 2, 2024

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.

hazirmagron avatar hazirmagron commented on May 2, 2024

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 a DropzoneArea 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.