-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move bundle into a separate npm package vanilla-jsoneditor (#114)
BREAKING CHANGE: The bundled file has been moved into a separate npm package named `vanilla-jsoneditor`. Please replace: `import { JSONEditor} from "svelte-jsoneditor/dist/jsoneditor.js"` with `import { JSONEditor} from "vanilla-jsoneditor"`. Read more about v0.5.0: https://github.com/josdejong/svelte-jsoneditor/blob/main/CHANGELOG.md
- Loading branch information
Showing
24 changed files
with
2,731 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
.idea | ||
node_modules | ||
/package | ||
/package-vanilla | ||
/.svelte-kit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.svelte-kit/** | ||
static/** | ||
package/** | ||
package-vanilla/** | ||
node_modules/** | ||
src/lib/generated/** | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# vanilla-jsoneditor | ||
|
||
A web-based tool to view, edit, format, transform, and validate JSON. | ||
|
||
This is the vanilla variant of `svelte-jsoneditor` that can be used in vanilla JavaScript or frameworks like SolidJS, React, Vue, Angular | ||
|
||
## Install | ||
|
||
Install using npm: | ||
|
||
``` | ||
npm install vanilla-jsoneditor | ||
``` | ||
|
||
## Use | ||
|
||
Browser example loading the ES module: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>JSONEditor</title> | ||
</head> | ||
<body> | ||
<div id="jsoneditor"></div> | ||
|
||
<script type="module"> | ||
import { JSONEditor } from 'vanilla-jsoneditor' | ||
let content = { | ||
text: undefined, | ||
json: { | ||
greeting: 'Hello World' | ||
} | ||
} | ||
const editor = new JSONEditor({ | ||
target: document.getElementById('jsoneditor'), | ||
props: { | ||
content, | ||
onChange: (updatedContent, previousContent, patchResult) => { | ||
// content is an object { json: JSONData } | { text: string } | ||
console.log('onChange', updatedContent, previousContent, patchResult) | ||
content = updatedContent | ||
} | ||
} | ||
}) | ||
// use methods get, set, update, and onChange to get data in or out of the editor. | ||
// Use updateProps to update properties. | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
|
||
## Documentation | ||
|
||
For documentation, see: https://github.com/josdejong/svelte-jsoneditor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.