Combining nodecontextmenu and nodeclick.
Closed this issue · 2 comments
volodymyrradchenko commented
Currently, item's not getting selected if you click on it with the right mouse button.
Is it possible to add nodeclick event right before nodecontextmenu is getting fired if one or less items are selected. Also, let it behave as it does currently if more than 1 items selected?
holiber commented
You can manually select the item in the nodecontextmenu handler.
Look at the demo in dark-theme.html
showContextMenu(node, event) {
event.preventDefault();
this.contextMenuIsVisible = true;
const $contextMenu = this.$refs.contextmenu;
$contextMenu.style.left = event.clientX + 'px';
$contextMenu.style.top = event.clientY + 'px';
this.$refs.slVueTree.select(node.path); // <-- add this line to select current node
},volodymyrradchenko commented
It helped, thank you!
Feels like pure magic