Conversation
Define the nodes that will have a context menu and which actions are permitted for each node by defining the 'context' option in the editor's options. For example the options below define that only node1, node2, and all the children of node3 and node4 will have a context menu. Moreover, node1 and node2 allow only the 'Remove' action while the children of node3 and node4 allow both the 'Duplicate' and 'Remove' actions.
context: {
items: {
node1: ['Remove'],
node2: ['Remove']
},
children: {
node3: ['Duplicate', 'Remove'],
node4: ['Duplicate', 'Remove']
}
}
|
Thanks Themistoklis. This looks interesting. Some thoughts:
|
# Conflicts: # src/js/Node.js
|
Yes, definitely a completely dynamic context menu would be much more useful! We can proceed the way you suggest! I prefer we to introduce a new option, instead of using the onEditable, in order to keep it clear. |
|
Agree |
|
#438 adds support for custom context menu items. |
Define the nodes with a context menu and the actions that are permitted for each node by defining the 'context' option in the editor's options.
For example the options below define that only node1, node2, and all the children of node3 and node4 will have a context menu. Moreover, node1 and node2 allow only the 'Remove' action while the children of node3 and node4 allow both the 'Duplicate' and 'Remove' actions: