Comments (3)
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:
- 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)
- 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.
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.
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:
- 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)
- 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)
- Output is Not define
- Block name change
- More advanced demo? HOT 7
- Prevent junctions
- Is it possible to implement for nodes to have more than 1 parent? HOT 4
- How to use it in Vuejs ? HOT 3
- Output not getting imported HOT 2
- Can you give me a solution to use it in React js ? HOT 3
- Conditional Snapping Issue HOT 1
- Please invite me in your project. HOT 1
- Drag block item when scrolled
- Hey
- Unable to add text box in the flowchart
- Demo Site link working HOT 1
- Live demo link broken HOT 2
- [Feature request] Dark theme
- Create zoom canva preview
- Support? HOT 2
- How to split branches manually
- How to support cyclic relations between blocks in flowy
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 flowy.