does this API uses web workers?
The Ace editor used in mode code uses a Webworker to validate valid JSON. Besides that no workers are used in the code base.
Ok! thanks, I want to load a big JSON file into the editor so should I use an external worker?
Just curious: what is the size of the large JSON files you're working with?
The largest bottleneck I encounter right now is not CPU but memory: if you open a large JSON file the browser runs out of memory. This is not easily solved though, and besides that the editor is currently tightly coupled with the DOM so you can't easily run in in a web worker. I'm working on a completely new editor where I keep support for large files in mind. But this new editor is far from finished.
I have a JSON file around 20 MB.
still thanks.
Thanks for the feedback. 20 MB should be fine, 100 MB or more probably crashes your browser.
Hey! I want to convert it under a web component, how can I do this.
I guess you can wrap the editor in a web component, just like you can create a wrapper for React or Vue around it.
@josdejong Hello josdejong, what's the use of the web worker? Just validate the valid JSON? And another question, the web worker refers to a location like 'blob:https://xx.xx.xx.xx:xxxx/51149bf7-ec30-4e6a-a74b-94d288c13564', how does this location been generated? The code in this location is secure or not, it's created by th JSONEditor? Because in my project, the browser report the error of CSP, so I'm worriy about the security of the code in this location. Look forward your reply!
@josdejong Hello josdejong, what's the use of the web worker?
See my previous comment: https://github.com/josdejong/jsoneditor/issues/708#issuecomment-497917841
I'm not sure what blob urls you mean. When opening https://unpkg.com/[email protected]/examples/03_switch_mode.html with a network console open and changing mode to "code" I don't see any such urls. Can it be embedded icons or so? How can I find these requests and reproduce your issue?
@josdejong I'm sorry I cannot upload the image which indicates the error in my console. It says the web worker url violates the CSP in the meta tag in my project. Because in your example, maybe you don't set the CSP, so you cannot see any error in the console. My question is can I use the "code" mode but without the web worker? Or can I use the "text" mode but with the line number just like the "code" mode?
So how can I reproduce your issue?
I doubt whether its possible to have the Ace editor but without wwbworker functionality. You would have to dive into the posibilities of Ace editor I think.
@josdejong Hello josdejong, what's the use of the web worker?
See my previous comment: #708 (comment)
I'm not sure what
bloburls you mean. When opening https://unpkg.com/[email protected]/examples/03_switch_mode.html with a network console open and changing mode to "code" I don't see any such urls. Can it be embedded icons or so? How can I find these requests and reproduce your issue?
You can set CSP script src directive like this :-
scriptSrc: ["'self'", "'unsafe-eval'", 'blob:', 'data:'],
it will work