react-json-editor-ajrm icon indicating copy to clipboard operation
react-json-editor-ajrm copied to clipboard

Fix onPaste returing error

Open sOoN92 opened this issue 3 years ago • 11 comments

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 avatar Oct 01 '21 10:10 sOoN92

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

sOoN92 avatar Oct 01 '21 10:10 sOoN92

@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.

oliverbock avatar Oct 22 '21 06:10 oliverbock

@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.

sOoN92 avatar Oct 22 '21 09:10 sOoN92

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

jlopvet avatar Dec 01 '21 15:12 jlopvet

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

sOoN92 avatar Dec 01 '21 15:12 sOoN92

@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.

jlopvet avatar Dec 01 '21 15:12 jlopvet

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

FYI @AndrewRedican

sOoN92 avatar Dec 20 '21 12:12 sOoN92

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

sOoN92 avatar Mar 30 '22 20:03 sOoN92

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

FYI @oliverbock @AndrewRedican

sOoN92 avatar Apr 13 '22 15:04 sOoN92

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

sOoN92 avatar Sep 14 '22 08:09 sOoN92

@sOoN92, it makes sense to me.

oliverbock avatar Sep 14 '22 22:09 oliverbock

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

raj-2011503554 avatar Nov 11 '22 11:11 raj-2011503554