Skip to content

Commit

Permalink
docs: improve the docs regarding json/text content (see #166)
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Oct 18, 2022
1 parent 67d78f0 commit f7f3837
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Create a JSONEditor with two-way binding `bind:json`:
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand All @@ -78,7 +78,7 @@ Or one-way binding:
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
greeting: 'Hello World'
}
Expand Down Expand Up @@ -187,7 +187,7 @@ const editor = new JSONEditor({

### properties

- `content: Content` Pass the JSON contents to be rendered in the JSONEditor. Contents is an object containing a property `json` and `text`. Only one of the two must be defined. In case of `tree` mode, `json` is used. In case of `text` mode, `text` is used.
- `content: Content` Pass the JSON contents to be rendered in the JSONEditor. `Content` is an object containing a property `json` (a parsed JSON document) or `text` (a stringified JSON document). Only one of the two properties must be defined. You can pass both content types to the editor independent of in what mode it is. When making a change in `tree` mode, the updated content will be `{ json }`. When making a change in `text` mode, the updated content will be of type `{ text }`. Please be aware that `text` can contain invalid JSON: whilst typing, a JSON document will be temporarily invalid, like when the user is typing a new string.
- `mode: 'tree' | 'text'`. Open the editor in `'tree'` mode (default) or `'text'` mode (formerly: `code` mode).
- `mainMenuBar: boolean` Show the main menu bar. Default value is `true`.
- `navigationBar: boolean` Show the navigation bar with, where you can see the selected path and navigate through your document from there. Default value is `true`.
Expand Down Expand Up @@ -484,7 +484,7 @@ For example, to change the default blue theme color to anthracite:
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
string: 'Hello custom theme color :)'
}
Expand Down Expand Up @@ -520,7 +520,7 @@ Full Svelte example:
import { JSONEditor } from 'svelte-jsoneditor'

let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
string: 'Hello dark theme :)'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/custom_dynamic_styling/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/custom_menu_buttons/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import copyToClipboard from '$lib/utils/copyToClipboard'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/custom_theme_color/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { JSONEditor } from 'svelte-jsoneditor'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
string: 'Hello custom theme color :)'
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/custom_validation/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
}
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
team: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/custom_value_renderer/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ReadonlyPassword from '../../components/ReadonlyPassword.svelte'
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
username: 'John',
password: 'secret...',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/json_schema_validation/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
firstName: 'John',
lastName: 'Doe',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/switch_themes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let selectedFontSize = fontSizes[1].value
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/examples/use_methods/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let refJsonEditor
let content = {
text: undefined, // used when in text mode
text: undefined, // can be used to pass a stringified JSON document instead
json: {
array: [1, 2, 3],
boolean: true,
Expand Down

0 comments on commit f7f3837

Please sign in to comment.