@json-editor/json-editor 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +4 -0
- package/.eslintrc +4 -1
- package/.github/workflows/build.yml +5 -4
- package/CHANGELOG.md +31 -0
- package/README.md +32 -1
- package/config/webpack.common.js +2 -6
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +4152 -3955
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/meta-schema.html +793 -0
- package/package.json +13 -13
- package/src/core.js +5 -1
- package/src/defaults.js +9 -2
- package/src/editor.js +34 -15
- package/src/editors/array.js +10 -7
- package/src/editors/base64.js +3 -0
- package/src/editors/describedby.js +2 -2
- package/src/editors/enum.js +9 -1
- package/src/editors/info.js +8 -0
- package/src/editors/multiple.js +16 -3
- package/src/editors/object.js +26 -7
- package/src/editors/radio.js +9 -2
- package/src/editors/select.js +19 -8
- package/src/editors/select2.js +1 -1
- package/src/editors/starrating.js +5 -4
- package/src/editors/string.js +17 -1
- package/src/editors/table.js +2 -2
- package/src/iconlib.js +0 -1
- package/src/schemaloader.js +2 -2
- package/src/style.css +4 -0
- package/src/style.css.js +1 -1
- package/src/templates/default.js +2 -2
- package/src/theme.js +13 -3
- package/src/themes/bootstrap3.js +0 -9
- package/src/themes/index.js +0 -1
- package/src/validator.js +4 -4
- package/tests/Dockerfile +1 -1
- package/tests/codeceptjs/core_test.js +8 -2
- package/tests/codeceptjs/editors/array_test.js +11 -6
- package/tests/codeceptjs/editors/autocomplete_test.js +0 -1
- package/tests/codeceptjs/editors/integer_test.js +0 -4
- package/tests/codeceptjs/editors/object_test.js +8 -0
- package/tests/codeceptjs/editors/rating_test.js +1 -1
- package/tests/codeceptjs/editors/select_test.js +18 -0
- package/tests/codeceptjs/editors/starrating_test.js +15 -0
- package/tests/codeceptjs/editors/string_test.js +7 -0
- package/tests/codeceptjs/issues/issue-gh-1158_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1164_test.js +0 -1
- package/tests/codeceptjs/issues/issue-gh-1171_test.js +11 -0
- package/tests/codeceptjs/issues/issue-gh-1272_test.js +21 -0
- package/tests/codeceptjs/issues/issue-gh-1383_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1452_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1485_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-1491_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1525_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1536_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1538_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1541_test.js +8 -0
- package/tests/docker-compose-local.yml +1 -2
- package/tests/docker-compose.yml +0 -1
- package/tests/pages/array-events-table.html +39 -31
- package/tests/pages/array-events.html +39 -31
- package/tests/pages/assets/autocomplete.css +1 -0
- package/tests/pages/assets/autocomplete.min.js +1 -0
- package/tests/pages/autocomplete.html +4 -4
- package/tests/pages/enforce-const.html +176 -0
- package/tests/pages/issues/issue-gh-1171.html +39 -0
- package/tests/pages/issues/issue-gh-1272.html +167 -0
- package/tests/pages/issues/issue-gh-1452.html +98 -0
- package/tests/pages/issues/issue-gh-1466.html +63 -0
- package/tests/pages/issues/issue-gh-1485.html +59 -0
- package/tests/pages/issues/issue-gh-1491.html +59 -0
- package/tests/pages/issues/issue-gh-1525.html +62 -0
- package/tests/pages/issues/issue-gh-1536.html +55 -0
- package/tests/pages/issues/issue-gh-1538.html +56 -0
- package/tests/pages/issues/issue-gh-1541.html +51 -0
- package/tests/pages/issues/issue-gh-1541.json +9 -0
- package/tests/pages/placeholder-options.html +57 -0
- package/tests/pages/prompt-paste-max-length-reached.html +51 -0
- package/tests/pages/remove-false-properties.html +85 -0
- package/tests/pages/starrating.html +86 -0
- package/tests/unit/editor.spec.js +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1466</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
|
10
|
+
<script src="../../../dist/nonmin/jsoneditor.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="container">
|
|
14
|
+
<textarea class="form-control" id="value" cols="30" rows="10"></textarea>
|
|
15
|
+
<a href="https://github.com/json-editor/json-editor/issues/1466">GitHub Issue 1466</a>
|
|
16
|
+
|
|
17
|
+
<p>Remove Item 2, then destroy editor. The row of Item 2 which is only stored in the cache is not destroyed.</p>
|
|
18
|
+
<div id='editor_holder'></div>
|
|
19
|
+
<button onclick="start()">start </button>
|
|
20
|
+
<button onclick="destroyEditor()">destroyEditor </button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
var value = document.querySelector('#value')
|
|
25
|
+
var editor;
|
|
26
|
+
function start()
|
|
27
|
+
{
|
|
28
|
+
var defaultSchema = {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"array": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"someProperty": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
46
|
+
iconlib: 'fontawesome5',
|
|
47
|
+
schema: defaultSchema,
|
|
48
|
+
show_errors: 'always',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
editor.on('ready', function () {
|
|
52
|
+
editor.setValue({ "array": [{ someProperty: "Item 1" }, { someProperty: "Item 2" }, { someProperty: "Item 3" }] })
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function destroyEditor()
|
|
57
|
+
{
|
|
58
|
+
editor.destroy();
|
|
59
|
+
editor = undefined;
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1485</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
|
10
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="container">
|
|
14
|
+
<h1>Test</h1>
|
|
15
|
+
<a href="https://github.com/json-editor/json-editor/issues/1485">Link to issue</a>
|
|
16
|
+
<div id='editor_holder'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const value = document.querySelector('#value')
|
|
21
|
+
const defaultSchema = {
|
|
22
|
+
"title": "json schema example",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"example": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"template": "random_string"
|
|
28
|
+
},
|
|
29
|
+
"first_name": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"last_name": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"full_name": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"template": "{{ fname }} {{ lname }}",
|
|
38
|
+
"watch": {
|
|
39
|
+
"fname": "first_name",
|
|
40
|
+
"lname": "last_name"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
window.JSONEditor.defaults.callbacks.template = {
|
|
47
|
+
"random_string": () => {
|
|
48
|
+
return Math.random() * 2
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
53
|
+
iconlib: 'fontawesome5',
|
|
54
|
+
schema: defaultSchema,
|
|
55
|
+
theme: 'bootstrap4'
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1491</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
|
10
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="container">
|
|
14
|
+
<h1>Test</h1>
|
|
15
|
+
<a href="https://github.com/json-editor/json-editor/issues/1491">Link to issue</a>
|
|
16
|
+
<div id='editor_holder'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const value = document.querySelector('#value')
|
|
21
|
+
const defaultSchema = {
|
|
22
|
+
"options": {
|
|
23
|
+
"titleHidden": true
|
|
24
|
+
},
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": [
|
|
27
|
+
"betreff",
|
|
28
|
+
"text"
|
|
29
|
+
],
|
|
30
|
+
"properties": {
|
|
31
|
+
"betreff": {
|
|
32
|
+
"title": "Betreff",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"maxLength": 100
|
|
36
|
+
},
|
|
37
|
+
"text": {
|
|
38
|
+
"title": "Text",
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "textarea",
|
|
41
|
+
"minLength": 1,
|
|
42
|
+
"maxLength": 500,
|
|
43
|
+
"options": {
|
|
44
|
+
"inputAttributes": {
|
|
45
|
+
"rows": 3
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
53
|
+
iconlib: 'fontawesome5',
|
|
54
|
+
schema: defaultSchema,
|
|
55
|
+
theme: 'bootstrap3'
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>GitHub Issue 1525</title>
|
|
6
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/npm/select2@latest/dist/js/select2.min.js "></script>
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@latest/dist/css/select2.min.css">
|
|
11
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div class="container">
|
|
15
|
+
<h1>Test</h1>
|
|
16
|
+
<a href="https://github.com/json-editor/json-editor/issues/1525">Link to issue</a>
|
|
17
|
+
|
|
18
|
+
<div class="form-group">
|
|
19
|
+
<label for="value">Value</label>
|
|
20
|
+
<textarea class="form-control" id="value" cols="30" rows="10"></textarea>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div id='editor_holder'></div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
window.addEventListener('load', () => {
|
|
28
|
+
const textareaValue = document.querySelector('#value')
|
|
29
|
+
const defaultSchema = {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"example": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"format": "select2",
|
|
35
|
+
"enum": ["aa", "bb", "cc"],
|
|
36
|
+
"options": {
|
|
37
|
+
"select2": {
|
|
38
|
+
"tags": true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
46
|
+
iconlib: 'fontawesome5',
|
|
47
|
+
schema: defaultSchema,
|
|
48
|
+
theme: 'bootstrap4',
|
|
49
|
+
show_errors: 'always'
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
editor.on('change', function () {
|
|
53
|
+
textareaValue.value = JSON.stringify(editor.getValue())
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
editor.on('ready', function () {
|
|
57
|
+
editor.getEditor('root.example').setValue('dd')
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
</script>
|
|
61
|
+
</body>
|
|
62
|
+
</html>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1536</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<h1>Test</h1>
|
|
13
|
+
<a href="https://github.com/json-editor/json-editor/issues/1536">Link to issue</a>
|
|
14
|
+
<div id='editor_holder'></div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
const value = document.querySelector('#value')
|
|
19
|
+
const defaultSchema = {
|
|
20
|
+
'title': 'Dependency chain support',
|
|
21
|
+
'type': 'object',
|
|
22
|
+
'properties': {
|
|
23
|
+
'dependent_field_two': {
|
|
24
|
+
'type': 'number',
|
|
25
|
+
'options': {
|
|
26
|
+
'dependencies': {
|
|
27
|
+
'dependent_field_one': true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
'dependent_field_one': {
|
|
32
|
+
'type': 'boolean',
|
|
33
|
+
'format': 'checkbox',
|
|
34
|
+
'options': {
|
|
35
|
+
'dependencies': {
|
|
36
|
+
'dependency_chain_head': true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
'dependency_chain_head': {
|
|
41
|
+
'type': 'boolean',
|
|
42
|
+
'default': false,
|
|
43
|
+
'format': 'checkbox'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
49
|
+
iconlib: 'fontawesome5',
|
|
50
|
+
schema: defaultSchema,
|
|
51
|
+
theme: 'bootstrap3'
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1538</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
|
10
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div class="container">
|
|
14
|
+
<h1>Test</h1>
|
|
15
|
+
<a href="https://github.com/json-editor/json-editor/issues/1538">Link to issue</a>
|
|
16
|
+
<div id='editor_holder'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const value = document.querySelector('#value')
|
|
21
|
+
const defaultSchema = {
|
|
22
|
+
'title': 'Dependency chain support',
|
|
23
|
+
'type': 'object',
|
|
24
|
+
'properties': {
|
|
25
|
+
'watched_field': {
|
|
26
|
+
'type': 'boolean',
|
|
27
|
+
'format': 'checkbox',
|
|
28
|
+
'default': false
|
|
29
|
+
},
|
|
30
|
+
'field_that_watch': {
|
|
31
|
+
'type': 'string',
|
|
32
|
+
'template': '{{content}}',
|
|
33
|
+
'watch': {
|
|
34
|
+
'content': 'root.watched_field',
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
'dependent_field': {
|
|
38
|
+
'type': 'boolean',
|
|
39
|
+
'format': 'checkbox',
|
|
40
|
+
'options': {
|
|
41
|
+
'dependencies': {
|
|
42
|
+
'field_that_watch': 'true'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
50
|
+
iconlib: 'fontawesome5',
|
|
51
|
+
schema: defaultSchema,
|
|
52
|
+
theme: 'bootstrap3'
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>dependentRequired</title>
|
|
6
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<div id='editor-container'></div>
|
|
15
|
+
|
|
16
|
+
<div class="form-group">
|
|
17
|
+
<label for="textarea-value">Value</label>
|
|
18
|
+
<textarea class="form-control" id="textarea-value" cols="30" rows="10"></textarea>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
var editorContainer = document.querySelector('#editor-container')
|
|
24
|
+
var textareaValue = document.querySelector('#textarea-value')
|
|
25
|
+
var schema = {
|
|
26
|
+
'title': 'Dependency chain support',
|
|
27
|
+
'type': 'object',
|
|
28
|
+
'properties': {
|
|
29
|
+
"reference": {
|
|
30
|
+
"title": "Reference",
|
|
31
|
+
"$ref": "issue-gh-1541.json"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var editor = new JSONEditor(editorContainer, {
|
|
37
|
+
schema: schema,
|
|
38
|
+
theme: 'bootstrap4',
|
|
39
|
+
iconlib: 'fontawesome',
|
|
40
|
+
show_errors: 'always',
|
|
41
|
+
show_opt_in: false,
|
|
42
|
+
ajax: true,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
editor.on('change', function () {
|
|
46
|
+
textareaValue.value = JSON.stringify(editor.getValue())
|
|
47
|
+
})
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
</body>
|
|
51
|
+
</html>`
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="de">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>placeholder-options</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<label for="value">Value</label>
|
|
15
|
+
<textarea class="form-control" id="value"></textarea>
|
|
16
|
+
<button id='set-value'>Set Value that is not in enum ("c")</button>
|
|
17
|
+
<div class='json-editor-container'></div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
const jsonEditorContainer = document.querySelector('.json-editor-container')
|
|
22
|
+
const value = document.querySelector('#value')
|
|
23
|
+
const setValue = document.querySelector('#set-value')
|
|
24
|
+
const schema = {
|
|
25
|
+
'title': 'test',
|
|
26
|
+
'type': 'string',
|
|
27
|
+
'enum': [
|
|
28
|
+
'a',
|
|
29
|
+
'b'
|
|
30
|
+
],
|
|
31
|
+
'options': {
|
|
32
|
+
'has_placeholder_option': true,
|
|
33
|
+
'placeholder_option_text': '-select-',
|
|
34
|
+
'enum_titles': [
|
|
35
|
+
'A',
|
|
36
|
+
'B'
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const editor = new JSONEditor(jsonEditorContainer, {
|
|
42
|
+
schema: schema,
|
|
43
|
+
theme: 'bootstrap4',
|
|
44
|
+
iconlib: 'fontawesome5'
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
editor.on('change', function () {
|
|
48
|
+
value.value = JSON.stringify(editor.getValue())
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
setValue.addEventListener('click', function () {
|
|
52
|
+
editor.setValue('other')
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>prompt_paste_max_length_reached</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<div id='editor-container'></div>
|
|
15
|
+
<button id="paste">Paste</button>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
20
|
+
const pasteBtn = document.querySelector('#paste')
|
|
21
|
+
const schema = {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"maxLength": 5
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const editor = new JSONEditor(editorContainer, {
|
|
27
|
+
schema: schema,
|
|
28
|
+
theme: 'bootstrap4',
|
|
29
|
+
iconlib: 'fontawesome',
|
|
30
|
+
show_errors: 'always',
|
|
31
|
+
prompt_paste_max_length_reached: true
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
pasteBtn.addEventListener('click', () => {
|
|
36
|
+
const inputElement = document.getElementById('root')
|
|
37
|
+
const pasteEvent = document.createEvent('Event')
|
|
38
|
+
pasteEvent.initEvent('paste', true, true)
|
|
39
|
+
|
|
40
|
+
pasteEvent.clipboardData = {
|
|
41
|
+
getData: format => {
|
|
42
|
+
return 'Hello world'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
inputElement.dispatchEvent(pasteEvent)
|
|
47
|
+
})
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
</body>
|
|
51
|
+
</html>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>remove_false_properties</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<label for="value">Value</label>
|
|
15
|
+
<textarea class="form-control" id="value" rows="12" style="font-size: 12px; font-family: monospace;"></textarea>
|
|
16
|
+
<div id='editor-container'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
21
|
+
const value = document.querySelector('#value')
|
|
22
|
+
const schema = {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"options": {
|
|
25
|
+
"remove_false_properties": true
|
|
26
|
+
},
|
|
27
|
+
"properties": {
|
|
28
|
+
"a": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"format": "checkbox",
|
|
31
|
+
"options": {
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"a": [
|
|
34
|
+
true
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"b": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"format": "checkbox",
|
|
42
|
+
"options": {
|
|
43
|
+
"remove_false_properties": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"c": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"format": "checkbox"
|
|
49
|
+
},
|
|
50
|
+
"d": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"format": "checkbox"
|
|
53
|
+
},
|
|
54
|
+
"e": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"format": "checkbox"
|
|
57
|
+
},
|
|
58
|
+
"f": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"format": "checkbox"
|
|
61
|
+
},
|
|
62
|
+
"g": {
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"format": "checkbox"
|
|
65
|
+
},
|
|
66
|
+
"h": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"format": "checkbox"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const editor = new JSONEditor(editorContainer, {
|
|
74
|
+
schema: schema,
|
|
75
|
+
theme: 'bootstrap4',
|
|
76
|
+
iconlib: 'fontawesome',
|
|
77
|
+
show_errors: 'always',
|
|
78
|
+
remove_false_properties: false
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
editor.on('change', function () {
|
|
82
|
+
value.value = JSON.stringify(editor.getValue())
|
|
83
|
+
})
|
|
84
|
+
</script>
|
|
85
|
+
</body>
|