AndrewRedican / react-json-editor-ajrm

A modular, easy to use, react component, to view, edit, and debug javascript objects.
MIT License
355 stars 126 forks source link

Fix onPaste returing error #193

Closed sOoN92 closed 1 year ago

sOoN92 commented 3 years ago

When pasting a JSON the component returns this error:

Non-alphanumeric token ' ' is not allowed outside string notation at line 1

I made a fix on onPaste method on line 571:

var text = event.clipboardData.getData('text/plain').replace(/(\r\n|\n|\r|\t|\u200B)/gm, '');

The replace added at the end of that line, remove the undesired characters causing the error.

sOoN92 commented 3 years ago

@AndrewRedican do you still approve PR or follow this project? I can help you on this if you want.

oliverbock commented 3 years ago

@sOoN92, @AndrewRedican might not be accepting this PR because it includes code to delete most of README.md and updates package-lock.json, etc. Perhaps you should cut it back to just the one line change in src/index.js.

sOoN92 commented 3 years ago

@sOoN92, @AndrewRedican might not be accepting this PR because it includes code to delete most of README.md and updates package-lock.json, etc. Perhaps you should cut it back to just the one line change in src/index.js.

Fixed.

jlopvet commented 2 years ago

@sOoN92 are you sure of your fix ? Tested on my side and still had the error.

sOoN92 commented 2 years ago

@jlopvet I'm pretty sure, I don't have the error anymore. Can you share the test steps?

jlopvet commented 2 years ago

@sOoN92 changed line 636 to var text = event.clipboardData.getData('text/plain').replace(/(\r\n|\n|\r|\t)/gm, ''); Relaunched my dev server, pasted some json (with double quoted keys) and same error.

sOoN92 commented 2 years ago

@jlopvet can you share the test you made, so I can double-check it?

FYI @AndrewRedican

sOoN92 commented 2 years ago

I updated the PR, can you check it again please @jlopvet ?

sOoN92 commented 2 years ago

I updated the PR, can you check it again please @jlopvet ?

FYI @oliverbock @AndrewRedican

sOoN92 commented 2 years ago

Guys can you please check the pr again? @oliverbock @AndrewRedican @jlopvet ?

oliverbock commented 2 years ago

@sOoN92, it makes sense to me.

raj-2011503554 commented 1 year ago

me too facing the same issue is the fix will be provided ??