josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
820 stars 108 forks source link

Where is dist folder for javascript use #265

Closed hoogw closed 1 year ago

hoogw commented 1 year ago

I want to use it in browser with plain javascript. But after I download .zip, can't find dist folder.

I don't know how to build to generate this file.

/node_modules/svelte-jsoneditor/dist/jsoneditor.js

Can you include dist folder in release .zip file or show us how to bundle it to generate a dist folder?

This is error when I try to build dist folder,

Screenshot 2023-04-29 at 10 20 58 AM

I also tried

// svelte-jsoneditor (vanilla-jsoneditor for plain js)
   <script src='/public/utility/vanilla-jsoneditor/index.js'>

does not work either

I tried 53, but doesn't make it work for me

https://github.com/josdejong/svelte-jsoneditor/issues/53

try #https://github.com/josdejong/svelte-jsoneditor/issues/165 still not work,

How to make it works?

josdejong commented 1 year ago

I think you're looking for the vanilla bundle. This bundle is an ES module though, not UMD, see #165, #195.

Docs: https://github.com/josdejong/svelte-jsoneditor#standalone-bundle-use-in-react-vue-angular-plain-javascript-

hoogw commented 1 year ago

I did a test page, but it does not work, I can't see it. However, it load ok, I don't see error in console.

Here is code,

Screenshot 2023-05-03 at 4 06 37 PM

Here is folder

Screenshot 2023-05-03 at 4 08 20 PM

Here is inspect. jsoneditor's height is 0, it should not be 0, must be something wrong

Screenshot 2023-05-03 at 4 19 31 PM

I try this, still not work

Screenshot 2023-05-03 at 4 24 22 PM
josdejong commented 1 year ago

Do you get the source mapping in the following example? https://jsbin.com/yuwapaj/edit?html,output

afbeelding

hoogw commented 1 year ago

Thank you, josdejong that solution is perfect !! I closed this ticket.

This is how I use new vanilla jsoneditor, click link

https://transparentgov.net/json2tree/esri/server2/folder.html?org=https%3A%2F%2Fgisportal.hrsa.gov%2Fserver%2Frest%2Fservices&url=https%3A%2F%2Fgisportal.hrsa.gov%2Fserver%2Frest%2Fservices&select_folder=74&select_layer=1

This is how it looks like

Screenshot 2023-05-11 at 12 22 46 PM