reduxjs / redux-devtools

DevTools for Redux with hot reloading, action replay, and customizable UI

Home Page:http://youtube.com/watch?v=xsSnOQynTHs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot get full path of JSON Key when using react-json-tree

mcnaveen opened this issue · comments

onDragStart callback in the valueRenderer props is not returning the full path of the json key.

For example:

  • when dragging the value "Electronics products" it should return something like this x.data[0].description but it just returns "description"

I'm not sure how to change this. I also created a stackblitz sandbox for you to test.

https://stackblitz.com/edit/stackblitz-starters-z1cita?file=src%2Fcomponents%2FViewer.jsx

valueRenderer={(raw, value, key) => (
  <span
    draggable={true}
    onDragStart={(e) => {
      const updatedNamespace =
        selected.namespace.length > 0
          ? [...selected.namespace, key]
          : [key];
      const fullPath = updatedNamespace.join('.');
      e.dataTransfer.setData('text/plain', fullPath);
      e.dataTransfer.setDragImage(document.createElement('span'), 0, 0);
    }}
  >
    {raw}
  </span>
)}
2023-11-22.15-43-22.mp4