Git Product home page Git Product logo

Comments (3)

yellow1912 avatar yellow1912 commented on May 9, 2024 1

I think all the options you listed are good. Perhaps we could do a beforeRemove which may return a Promise which can either resolve or reject? That way:

  1. It will be up to the developer to handle the logic (either a popup modal, or perhaps a long running ajax check to the server etc)
  2. For the option that allows dropping to a delete zone, I also like that idea but perhaps that can be simplified by exposing an api to delete a specific block. (And an api to add a block at a specific location is also nice)

Either way, if the delete is not allowed, the node can be set back to where it was.

I like the current auto-position feature, I think it's nice to keep. I have seen other libs that force you to manually delete (perhaps via a trash icon) and allow you to re-arrange the blocks. I don't think the re-arrangement is necessary here in this case if we want to keep the lib simple.

from flowy.

alyssaxuu avatar alyssaxuu commented on May 9, 2024

Yeah I can see how that can be an issue. I'm just not sure what the expected behaviour should be here. Should there be a modal that asks if you want to delete the blocks, and if not they should re-attach where they were before? Should it only delete the blocks when moved towards a "deletion area" such as on the left (or maybe creating a sort of "trash bin" icon that pops up while moving blocks that you can throw blocks into), and otherwise either re-attach where it was if dropped anywhere in the canvas or to any other spot you want to move it to?

I'm just wondering. I suppose ideally people might want new trees to form when dropped in the canvas, I just haven't figured out an intuitive implementation for that yet (it's tricky because of how the blocks are centered and aligned, they automatically position themselves in a way that they don't overlap & don't get cut off, but if people were able to drop blocks anywhere, it might not be wise to prevent overlapping).

from flowy.

alyssaxuu avatar alyssaxuu commented on May 9, 2024

I think all the options you listed are good. Perhaps we could do a beforeRemove which may return a Promise which can either resolve or reject? That way:

  1. It will be up to the developer to handle the logic (either a popup modal, or perhaps a long running ajax check to the server etc)
  2. For the option that allows dropping to a delete zone, I also like that idea but perhaps that can be simplified by exposing an api to delete a specific block. (And an api to add a block at a specific location is also nice)

Either way, if the delete is not allowed, the node can be set back to where it was.

I like the current auto-position feature, I think it's nice to keep. I have seen other libs that force you to manually delete (perhaps via a trash icon) and allow you to re-arrange the blocks. I don't think the re-arrangement is necessary here in this case if we want to keep the lib simple.

Just added the new method. Kept it simple, you pass a function that will re-attach the blocks with the previous parent if it returns true.

from flowy.

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.