Skip to content

Disable selection deleting #375

Answered by bcakmakoglu
brandonreid asked this question in Q&A
Discussion options

You must be logged in to vote

There's a couple of ways to prevent elements being deleted.
Here are two simple ways of going about it.

  • Set deleteKeyCode to false
    • You can toggle it if you need to, just set it back to Backspace or whatever key you'd like - a cb function is also allowed.
  • Set applyDefault to false
    • By setting applyDefault to false you disable the default change handlers, i.e. no more changes are processed
    • Now you can hook yourself into those changes are have control over what changes are valid and which aren't, changes are still emitted to you, just not handled anymore
    • After you're doing validating the changes, i.e. you filter your changes into a new array, you can use applyNodeChanges or applyEdgeChanges

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by brandonreid
Comment options

You must be logged in to vote
1 reply
@bcakmakoglu
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants