N00ts/vue3-treeview

Can we trigger an node edit event

alokswain opened this issue · 1 comments

We want to add a edit icon to a node which can trigger the node edit like doubleclick does. It will make the feature very easily discoverable. The button can be added via slot but can I trigger the node edit event

<template #after-input="props">
    <span class="actions">
    <span class="edit_node" @click="triggerNodeEdit(props)">Edit</span>
 </span>

any ideas as to how I can achieve this ?

Hi @N00ts - Any ideas on how to achieve this.

I tried triggering the dblclick event as below but could not.

triggerNodeEdit(event, props){
       var dblClickEvent = new MouseEvent('click', {
         'view': window,
         'bubbles': true,
         'cancelable': true
       });
      event.target.parentNode.parentNode.parentNode.querySelector(".input-wrapper").querySelector(".node-text").dispatchEvent(dblClickEvent);
}