@json-editor/json-editor 2.8.0 → 2.9.0-beta.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/README.md +30 -9
  3. package/dist/jsoneditor.js +2 -2
  4. package/dist/nonmin/jsoneditor.js +1211 -126
  5. package/dist/nonmin/jsoneditor.js.map +1 -1
  6. package/docs/index.html +22 -10
  7. package/docs/meta_schema.json +3 -2
  8. package/docs/starrating.html +2 -6
  9. package/package.json +4 -2
  10. package/src/defaults.js +9 -1
  11. package/src/editor.js +17 -3
  12. package/src/editors/array.js +7 -4
  13. package/src/editors/multiselect.js +1 -0
  14. package/src/editors/object.css +3 -3
  15. package/src/editors/object.css.js +1 -1
  16. package/src/editors/object.js +5 -2
  17. package/src/editors/table.js +11 -4
  18. package/src/editors/upload.js +3 -2
  19. package/src/schemaloader.js +112 -19
  20. package/src/themes/barebones.js +3 -1
  21. package/src/themes/bootstrap5.css +97 -0
  22. package/src/themes/bootstrap5.css.js +3 -0
  23. package/src/themes/bootstrap5.js +623 -0
  24. package/src/themes/index.js +2 -0
  25. package/src/themes/tailwind.js +2 -2
  26. package/tests/codeceptjs/core_test.js +128 -17
  27. package/tests/codeceptjs/editors/array_test.js +6 -5
  28. package/tests/codeceptjs/editors/button_test.js +7 -6
  29. package/tests/codeceptjs/editors/checkbox_test.js +3 -2
  30. package/tests/codeceptjs/editors/integer_test.js +3 -2
  31. package/tests/codeceptjs/editors/issues/issue-gh-1158_test.js +10 -0
  32. package/tests/codeceptjs/editors/issues/issue-gh-1257_test.js +13 -0
  33. package/tests/codeceptjs/editors/number_test.js +2 -1
  34. package/tests/codeceptjs/editors/object_test.js +39 -38
  35. package/tests/codeceptjs/editors/option-no_default_values_test.js +1 -1
  36. package/tests/codeceptjs/editors/programmatic-changes_test.js +3 -2
  37. package/tests/codeceptjs/editors/tabs_test.js +5 -3
  38. package/tests/codeceptjs/editors/validation_test.js +3 -1
  39. package/tests/codeceptjs/meta-schema_test.js +72 -4
  40. package/tests/codeceptjs/schemaloader_test.js +2 -1
  41. package/tests/codeceptjs/test-config.js +3 -0
  42. package/tests/codeceptjs/themes_test.js +14 -0
  43. package/tests/pages/anyof-2.html +90 -0
  44. package/tests/pages/anyof.html +1 -1
  45. package/tests/pages/{table-move-events.html → array-events-table.html} +0 -0
  46. package/tests/pages/{array-move-events.html → array-events.html} +0 -0
  47. package/tests/pages/container-attributes.html +50 -0
  48. package/tests/pages/issues/issue-gh-1158.html +50 -0
  49. package/tests/pages/issues/issue-gh-1233-failing.html +46 -0
  50. package/tests/pages/issues/issue-gh-1233-passing.html +49 -0
  51. package/tests/pages/issues/issue-gh-1257.html +77 -0
  52. package/tests/pages/meta-schema.html +747 -0
  53. package/tests/pages/meta_schema.json +3 -16
  54. package/tests/pages/oneof-2.html +90 -0
  55. package/tests/pages/per-editor-options.html +44 -0
  56. package/tests/pages/references.html +6 -0
  57. package/tests/pages/stepper.html +2 -2
  58. package/tests/pages/themes.html +2 -0
  59. package/tests/unit/schemaloader.spec.js +108 -2
package/CHANGELOG.md CHANGED
@@ -1,6 +1,34 @@
1
1
  ### Unreleased
2
2
 
3
- ### 2.7.1
3
+ ### 2.9.0-beta.1
4
+
5
+ - Fixed editors default values bug
6
+ - Fixed typo in example schema
7
+ - Fixed color editors default value bug
8
+ - Improved docs page UI with ACE editor and some spacing
9
+ - Fixed hidden option for upload editor
10
+ - Fixed array editors events and callbacks params
11
+ - Added link to GitHub repo in docs page
12
+ - Fixed typo in code
13
+ - Added test for meta-schema scenario
14
+ - Added test for $ref schema with oneOf/anyOf scenario
15
+ - Added Bootstrap 5 theme
16
+ - Removed !important flags from CSS
17
+ - Added upload translations
18
+ - Updated SCEditor documentation
19
+ - Fixed test waits
20
+ - Fixed per editor Options
21
+ - Fixed bug in tailwind and barebones theme. Append errors to element that exist.
22
+ - Fixed #1194 Event listener removed after destroy
23
+ - Added setContainerAttributes option
24
+ - Fixed select2/selectize cannnot add new option
25
+
26
+ ### 2.9.0-beta.0
27
+
28
+ - Enh #1162 Added cache system for schema loader (chhill-redhat)
29
+ - Added warnings undefined callbacks
30
+
31
+ ### 2.8.0
4
32
 
5
33
  - Added feature: use_name_attributes option
6
34
 
package/README.md CHANGED
@@ -139,6 +139,16 @@ Here are all the available options:
139
139
  <td>If <code>true</code>, JSON Editor will make ajax call with [credentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).</td>
140
140
  <td><code>false</code></td>
141
141
  </tr>
142
+ <tr>
143
+ <td>ajax_cache_responses</td>
144
+ <td>If <code>true</code>, JSON Editor will cache external URLs' schemas in <code>localStorage</code> to avoid subsequent ajax calls.</td>
145
+ <td><code>false</code></td>
146
+ </tr>
147
+ <tr>
148
+ <td>ajax_cache_buster</td>
149
+ <td>If <code>ajax_cache_responses</code> is enabled, use this string to invalidate stale caches. E.g., this value should be changed when schemas are updated.</td>
150
+ <td>Current date in simplied ISO-8601 format (e.g., "2011-10-05" for October 5, 2011).</td>
151
+ </tr>
142
152
  <tr>
143
153
  <td>compact</td>
144
154
  <td>If <code>true</code>, the label will not be displayed/added.</td>
@@ -453,6 +463,7 @@ The currently supported themes are:
453
463
  * barebones
454
464
  * html (the default)
455
465
  * bootstrap4
466
+ * bootstrap5
456
467
  * spectre
457
468
  * tailwind
458
469
 
@@ -714,7 +725,8 @@ Here is an example that will show a color picker in browsers that support it:
714
725
 
715
726
  #### String Editors Input Attributes
716
727
 
717
- You can set custom attributes such as **placeholder**, **class** and **data-** on the input field using the special options keyword `inputAttributes`.
728
+ You can set custom attributes such as **placeholder**, **class** and **data-** on the input field and on the editor container
729
+ using the special options keyword `inputAttributes` and `containerAttributes`.
718
730
 
719
731
  Like this:
720
732
 
@@ -728,6 +740,10 @@ Like this:
728
740
  "inputAttributes": {
729
741
  "placeholder": "your name here...",
730
742
  "class": "myclass"
743
+ },
744
+ "containerAttributes": {
745
+ "data-container": "my-container",
746
+ "class": "my-container-class"
731
747
  }
732
748
  }
733
749
  }
@@ -739,12 +755,12 @@ Like this:
739
755
 
740
756
  In addition to the standard HTML input formats, JSON Editor can also integrate with several 3rd party specialized editors. These libraries are not included in JSON Editor and you must load them on the page yourself.
741
757
 
742
- __SCEditor__ provides WYSIWYG editing of HTML and BBCode. To use it, set the format to `html` or `bbcode` and set the `wysiwyg` option to `true`:
758
+ __SCEditor__ provides WYSIWYG editing of HTML and BBCode. To use it, set the format to `xhtml` or `bbcode` and set the `wysiwyg` option to `true`:
743
759
 
744
760
  ```json
745
761
  {
746
762
  "type": "string",
747
- "format": "html",
763
+ "format": "xhtml",
748
764
  "options": {
749
765
  "wysiwyg": true
750
766
  }
@@ -886,8 +902,10 @@ Creates a button whose click callback can be defined in `JSONEditor.defaults.cal
886
902
 
887
903
  - `icon`: Renders an icon into the button. Must be supported by the iconLib used.
888
904
  - `validated`: With `true` the button is disabled until the whole editor is valid.
889
- - `action`: the name of the callback that will be invoked when the button is clicked. Callbacks
890
- must be defined in `JSONEditor.defaults.callbacks`.
905
+ - `action`: the name of the callback that will be invoked when the button is clicked.
906
+
907
+ > **Warning**
908
+ > For the form to render properly all callbacks used in `action`s must also be defined in `JSONEditor.defaults.callbacks`.
891
909
 
892
910
  ```js
893
911
  JSONEditor.defaults.callbacks = {
@@ -1000,14 +1018,17 @@ When an array item is added, removed, moved up, moved or removed the json editor
1000
1018
  editor.on('moveRow', editor => {
1001
1019
  console.log('moveRow', editor)
1002
1020
  });
1021
+
1003
1022
  editor.on('addRow', editor => {
1004
1023
  console.log('addRow', editor)
1005
1024
  });
1006
- editor.on('deleteRow', editor => {
1007
- console.log('deleteRow', editor)
1025
+
1026
+ editor.on('deleteRow', deletedValue => {
1027
+ console.log('deleteRow', deletedValue)
1008
1028
  });
1009
- editor.on('deleteAllRows', editor => {
1010
- console.log('deleteAllRows', editor)
1029
+
1030
+ editor.on('deleteAllRows', deletedValues => {
1031
+ console.log('deleteAllRows', deletedValues)
1011
1032
  });
1012
1033
  ```
1013
1034