JSON-Viewer icon indicating copy to clipboard operation
JSON-Viewer copied to clipboard

Copy value from JSON Viewer

Open visch opened this issue 7 years ago • 6 comments

It'd be awesome if you could copy the value directly from the JSON viewer object.

Flow would be something like

  1. Right click object in JSON Viewer
  2. Click Copy
  3. Viola

visch avatar Jun 22 '17 13:06 visch

Good feature! will work on it

kapilratnani avatar Jun 27 '17 03:06 kapilratnani

@SinghRajenM Can you help with this feature? There is a branch node_click_action which has WIP. I am stuck at creating rapidjson DOM object using a SAX stream.

kapilratnani avatar Jan 08 '19 05:01 kapilratnani

@kapilratnani, Sure, I will check it and update you.

SinghRajenM avatar Jan 08 '19 06:01 SinghRajenM

@kapilratnani, I have one query about the behavior of copy function. image

Consider, the above screenshot. What should happen?

When user clicks the highlighted marks 1 and 3 under node 0? As per me: No action.

When user clicks the highlighted marks 2 and 4 under node 0? As per me: On 2: copy => "display-name: switcher" and on 4: copy => "Name: Rajen"

Or let me know if the expectation is something else.

SinghRajenM avatar Jan 12 '19 14:01 SinghRajenM

When one clicks on the node and clicks Copy the object under should get copied to clipboard as JSON text. For Ex: When copy is selected on the right click menu on the mark 1 clipboard should have: { "folder-name":"switcher", .... }

kapilratnani avatar Jan 15 '19 17:01 kapilratnani

I had written the logic which was as follows:

  1. Create a DOM object using the rapidjson SAX stream
  2. on each node in the tree view store path string using lparam. (path string: "/a/b/c")
  3. when selected to Copy, get path string from the tree view node
  4. use the path string to extract object from the DOM object created in 1.

It seems i haven't pushed the code in the branch, will do it.

kapilratnani avatar Jan 15 '19 18:01 kapilratnani

@visch , I am developing this feature and it is almost complete. Would you please mind if I ask you to test it and provide any early feedback?

Please note: currently, it copies node name, value, and path. Will try to extend it to copy the while array/object in near future.

How to test

  1. Download binary from build room https://ci.appveyor.com/project/kapilratnani/json-viewer as appropriate e.g. win32 or x64 or ARM64
  2. Open Notepad++ plugin folder
    1. Open plugin folder, go to Plugins menu on Notepad++
    2. Click on Open Plugins Folder
  3. Navigate to NPPJSONViewer and rename the existing NPPJSONViewer.dll for backup.
  4. Copy the downloaded binary (in step # 1) to NPPJSONViewer folder.
  5. Run some test
  6. Once done, restore the backup. To restore,
    1. Delete the new file (NPPJSONViewer.dll)
    2. Rename the old file to NPPJSONViewer.dll
    3. Now backup is restored.

image

SinghRajenM avatar Sep 21 '22 03:09 SinghRajenM

@visch , I am developing this feature and it is almost complete. Would you please mind if I ask you to test it and provide any early feedback?

Please note: currently, it copies node name, value, and path. Will try to extend it to copy the while array/object in near future.

How to test

  1. Download binary from build room https://ci.appveyor.com/project/kapilratnani/json-viewer as appropriate e.g. win32 or x64 or ARM64

  2. Open Notepad++ plugin folder

    1. Open plugin folder, go to Plugins menu on Notepad++
    2. Click on Open Plugins Folder
  3. Navigate to NPPJSONViewer and rename the existing NPPJSONViewer.dll for backup.

  4. Copy the downloaded binary (in step # 1) to NPPJSONViewer folder.

  5. Run some test

  6. Once done, restore the backup. To restore,

    1. Delete the new file (NPPJSONViewer.dll)
    2. Rename the old file to NPPJSONViewer.dll
    3. Now backup is restored.

image

Slight issue with the Json Viewer not working until I hit the refresh button. Video here (uploaded as the link before didn't work)

https://user-images.githubusercontent.com/8680264/191601065-bf41b378-c6b1-465c-af3c-4fed0cf2517c.mp4

Other than that (and the array issue) it looks to be working!

visch avatar Sep 21 '22 20:09 visch

@visch Thanks for sparing some time and testing it.

Slight issue with the Json Viewer not working until I hit the refresh button. Video here (uploaded as the link before didn't work)

What Noptepad++ version do you use? I'm unable to reproduce it with Notepad++ v8.4.5 (64-bit). I will check 32 bit as well.

SinghRajenM avatar Sep 24 '22 07:09 SinghRajenM