@json-editor/json-editor 2.6.0 → 2.6.1

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/docs/cleave.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
11
 
12
12
  <!-- jQuery -->
13
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
13
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
14
14
 
15
15
  <!-- Bootstrap4 -->
16
16
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
@@ -10,7 +10,7 @@
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
11
 
12
12
  <!-- jQuery -->
13
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
13
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
14
14
 
15
15
  <!-- Bootstrap4 -->
16
16
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
@@ -8,7 +8,7 @@
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
9
 
10
10
  <!-- jQuery -->
11
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
12
12
 
13
13
  <!-- Bootstrap4 -->
14
14
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
package/docs/index.html CHANGED
@@ -364,7 +364,7 @@
364
364
  },
365
365
  sceditor: {
366
366
  js: [
367
- 'https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js',
367
+ 'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js',
368
368
  'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/sceditor.min.js',
369
369
  'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/formats/bbcode.js',
370
370
  'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/formats/xhtml.js'
@@ -383,7 +383,7 @@
383
383
  },
384
384
  select2: {
385
385
  js: [
386
- 'https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js',
386
+ 'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js',
387
387
  'https://cdn.jsdelivr.net/npm/select2@4.0.6-rc.1/dist/js/select2.min.js'
388
388
  ],
389
389
  css: [
@@ -75,7 +75,7 @@
75
75
  </div>
76
76
  </div>
77
77
 
78
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
78
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
79
79
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
80
80
 
81
81
  <script>
package/docs/radio.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
11
 
12
12
  <!-- jQuery -->
13
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
13
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
14
14
 
15
15
  <!-- Bootstrap4 -->
16
16
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
package/docs/select2.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <title>JSON Editor Select2 Integration Example</title>
6
6
  <!-- jQuery -->
7
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
7
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
8
8
 
9
9
  <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
10
10
 
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <title>JSON Editor Selectize Integration Example</title>
6
6
  <!-- jQuery -->
7
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
7
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
8
8
 
9
9
  <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
10
10
 
@@ -10,7 +10,7 @@
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
11
 
12
12
  <!-- jQuery -->
13
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
13
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
14
14
 
15
15
  <!-- Bootstrap4 -->
16
16
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
package/docs/wysiwyg.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <title>JSON Editor WYSIWYG Example</title>
6
6
  <!-- jQuery -->
7
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
7
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
8
8
 
9
9
  <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
10
10
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@json-editor/json-editor",
3
3
  "title": "JSONEditor",
4
4
  "description": "JSON Schema based editor",
5
- "version": "2.6.0",
5
+ "version": "2.6.1",
6
6
  "main": "dist/jsoneditor.js",
7
7
  "author": {
8
8
  "name": "Jeremy Dorn",
package/src/editor.js CHANGED
@@ -153,7 +153,7 @@ export class AbstractEditor {
153
153
  this.dependenciesFulfilled = false
154
154
  } else if (Array.isArray(choices)) {
155
155
  this.dependenciesFulfilled = choices.some(choice => {
156
- if (value === choice) {
156
+ if (JSON.stringify(value) === JSON.stringify(choice)) {
157
157
  return true
158
158
  }
159
159
  })
@@ -637,7 +637,7 @@ export class ObjectEditor extends AbstractEditor {
637
637
  this.addproperty_holder.appendChild(spacer)
638
638
 
639
639
  /* Close properties modal if clicked outside modal */
640
- document.addEventListener('click', this.onOutsideModalClick)
640
+ document.addEventListener('click', this.onOutsideModalClick.bind(this))
641
641
 
642
642
  /* Description */
643
643
  if (this.schema.description) {
@@ -1042,9 +1042,8 @@ export class ObjectEditor extends AbstractEditor {
1042
1042
  }
1043
1043
 
1044
1044
  onOutsideModalClick (e) {
1045
- if (this.addproperty_holder &&
1046
- !this.addproperty_holder.contains(e.path[0] || e.composedPath()[0]) &&
1047
- this.adding_property) {
1045
+ const path = e.path || (e.composedPath && e.composedPath())
1046
+ if (this.addproperty_holder && !this.addproperty_holder.contains(path[0]) && this.adding_property) {
1048
1047
  e.preventDefault()
1049
1048
  e.stopPropagation()
1050
1049
  this.toggleAddProperty()
@@ -231,7 +231,7 @@ Scenario('should have unique ids', (I) => {
231
231
  I.waitForText('i am actually a cat')
232
232
  })
233
233
 
234
- Scenario('should hide properties with unfulfilled dependencies', (I) => {
234
+ Scenario('should hide properties with unfulfilled dependencies @dependencies', (I) => {
235
235
  I.amOnPage('object-with-dependencies.html')
236
236
  I.seeElement('[data-schemapath="root.enable_option"] input')
237
237
  I.dontSeeElement('[data-schemapath="root.make_new"] input')
@@ -243,13 +243,33 @@ Scenario('should hide properties with unfulfilled dependencies', (I) => {
243
243
  I.dontSeeElement('[data-schemapath="root.existing_name"] input')
244
244
  })
245
245
 
246
- Scenario('should respect multiple dependency values', (I) => {
246
+ Scenario('should respect multiple dependency values @dependencies', (I) => {
247
247
  I.amOnPage('object-with-dependencies-array.html')
248
- I.waitForVisible('[data-schemapath="root.answerB"] input', 5)
249
- I.selectOption('[name="root[answerA]"]', 'C')
250
- I.waitForInvisible('[data-schemapath="root.answerB"] input', 5)
251
- I.selectOption('[name="root[answerA]"]', 'B')
252
- I.waitForVisible('[data-schemapath="root.answerB"] input', 5)
253
- I.selectOption('[name="root[answerA]"]', 'A')
254
- I.waitForVisible('[data-schemapath="root.answerB"] input', 5)
248
+ I.waitForVisible('[data-schemapath="root.question_1"] select', 5)
249
+ I.selectOption('[name="root[question_1]"]', 'a')
250
+ I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', 5)
251
+ I.selectOption('[name="root[question_1]"]', 'b')
252
+ I.waitForVisible('[data-schemapath="root.question_1_feedback"]', 5)
253
+ I.selectOption('[name="root[question_1]"]', 'c')
254
+ I.waitForInvisible('[data-schemapath="root.question_1_feedback"]', 5)
255
+ I.selectOption('[name="root[question_1]"]', 'd')
256
+ I.waitForVisible('[data-schemapath="root.question_1_feedback"]', 5)
257
+
258
+ I.waitForVisible('[data-schemapath="root.question_2"]', 5)
259
+ I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', 5)
260
+ I.click('label[for="root[question_2]1"]')
261
+ I.click('label[for="root[question_2]2"]')
262
+ I.waitForVisible('[data-schemapath="root.question_2_feedback"]', 5)
263
+ I.click('label[for="root[question_2]0"]')
264
+ I.click('label[for="root[question_2]3"]')
265
+ I.waitForInvisible('[data-schemapath="root.question_2_feedback"]', 5)
266
+ })
267
+
268
+ Scenario('should open and close the properties modal', (I) => {
269
+ I.amOnPage('object.html')
270
+ I.seeElement('.json-editor-btn-edit_properties')
271
+ I.click('.json-editor-btn-edit_properties')
272
+ I.seeElement('.je-modal .property-selector')
273
+ I.click('textarea')
274
+ I.dontSeeElement('.je-modal .property-selector')
255
275
  })
@@ -9,28 +9,38 @@
9
9
  <div id="editor"></div>
10
10
  <script>
11
11
  const schema = {
12
- "title": "Person",
13
- "type": "object",
14
- "properties": {
15
- "answerA": {
16
- "title": "Question A:",
17
- "type": "string",
18
- "minLength": 1,
19
- "enum": [
20
- "A",
21
- "B",
22
- "C"
23
- ]
12
+ 'title': 'Test',
13
+ 'type': 'object',
14
+ 'properties': {
15
+ 'question_1': {
16
+ 'type': 'string',
17
+ 'title': 'Question 1',
18
+ 'enum': ['a', 'b', 'c', 'd']
24
19
  },
25
- "answerB": {
26
- "title": "Question B:",
27
- "type": "string",
20
+ 'question_1_feedback': {
21
+ 'type': 'info',
22
+ 'title': 'Question 1 is correct',
28
23
  "options": {
29
24
  "dependencies": {
30
- "answerA": [
31
- "A",
32
- "B"
33
- ]
25
+ "question_1": ['b', 'd']
26
+ }
27
+ }
28
+ },
29
+ 'question_2': {
30
+ "type": "array",
31
+ "uniqueItems": true,
32
+ 'title': 'Question 2',
33
+ "items": {
34
+ "type": "string",
35
+ 'enum': ['a', 'b', 'c', 'd']
36
+ }
37
+ },
38
+ 'question_2_feedback': {
39
+ 'type': 'info',
40
+ 'title': 'Question 2 is correct',
41
+ "options": {
42
+ "dependencies": {
43
+ "question_2": [['b', 'c']]
34
44
  }
35
45
  }
36
46
  }