@json-editor/json-editor 1.3.5 → 1.17.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/.claude/settings.local.json +8 -0
- package/.env +2 -0
- package/.env-dist +2 -0
- package/.eslintrc +10 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +9 -0
- package/.github/workflows/build.yml +70 -0
- package/.travis.yml +63 -9
- package/CHANGELOG.md +1152 -0
- package/CONTRIBUTING.md +44 -5
- package/Makefile +26 -0
- package/README.md +765 -138
- package/README_ADDON.md +577 -0
- package/UPGRADING.md +46 -0
- package/build/CssToJson.js +55 -0
- package/codecept.conf.js +35 -0
- package/config/.eslintrc +7 -0
- package/config/codeceptjs_helpers.js +146 -0
- package/config/helpers.js +10 -0
- package/config/karma.conf.js +89 -0
- package/config/readme.md +31 -0
- package/config/webpack.common.js +71 -0
- package/config/webpack.dev.js +15 -0
- package/config/webpack.nonmin.js +19 -0
- package/config/webpack.prod.js +24 -0
- package/dist/jsoneditor.js +2 -11013
- package/dist/jsoneditor.js.LICENSE.txt +15 -0
- package/dist/nonmin/jsoneditor.js +31392 -0
- package/dist/nonmin/jsoneditor.js.map +1 -0
- package/docs/basic.html +2 -2
- package/docs/basic_person.json +2 -1
- package/docs/choices.html +86 -0
- package/docs/cleave.html +11 -19
- package/docs/colorpicker.html +194 -0
- package/docs/css_integration.html +56 -54
- package/docs/custom-editor.html +92 -0
- package/docs/datetime.html +48 -21
- package/docs/describedby.html +161 -0
- package/docs/enumsource.html +67 -0
- package/docs/form-submission.html +162 -0
- package/docs/imask.html +192 -0
- package/docs/index.html +606 -423
- package/docs/materialize_css.html +1 -1
- package/docs/meta-schema.html +793 -0
- package/docs/meta_schema.json +446 -400
- package/docs/polyfills/assign.js +29 -0
- package/docs/radio.html +156 -0
- package/docs/recursive.html +15 -17
- package/docs/scripts/ajv-validator.js +8695 -0
- package/docs/select2.html +15 -9
- package/docs/selectize.html +11 -9
- package/docs/signature.html +12 -11
- package/docs/starrating.html +5 -17
- package/docs/upload.html +33 -23
- package/docs/uuid.html +70 -0
- package/docs/wysiwyg.html +14 -7
- package/jasmine.json +11 -0
- package/package.json +74 -25
- package/release-notes.md +90 -0
- package/src/core.js +411 -611
- package/src/defaults.js +385 -306
- package/src/editor.js +761 -520
- package/src/editors/ace.js +90 -0
- package/src/editors/array/choices.js +104 -0
- package/src/editors/array/select2.js +112 -0
- package/src/editors/array/selectize.js +108 -86
- package/src/editors/array.css +9 -0
- package/src/editors/array.css.js +3 -0
- package/src/editors/array.js +812 -695
- package/src/editors/autocomplete.js +59 -0
- package/src/editors/base64.js +148 -129
- package/src/editors/button.js +104 -0
- package/src/editors/checkbox.js +111 -76
- package/src/editors/choices.css +3 -0
- package/src/editors/choices.css.js +3 -0
- package/src/editors/choices.js +71 -0
- package/src/editors/colorpicker.js +105 -0
- package/src/editors/datetime.js +93 -79
- package/src/editors/describedby.js +190 -0
- package/src/editors/enum.js +131 -116
- package/src/editors/hidden.js +100 -86
- package/src/editors/index.js +81 -0
- package/src/editors/info.js +28 -0
- package/src/editors/integer.js +21 -8
- package/src/editors/ip.js +36 -0
- package/src/editors/jodit.js +66 -0
- package/src/editors/multiple.js +380 -241
- package/src/editors/multiselect.js +207 -207
- package/src/editors/null.js +15 -11
- package/src/editors/number.js +39 -30
- package/src/editors/object.css +41 -0
- package/src/editors/object.css.js +3 -0
- package/src/editors/object.js +1209 -1007
- package/src/editors/radio.js +128 -0
- package/src/editors/sceditor.js +74 -0
- package/src/editors/select.js +318 -342
- package/src/editors/select2.js +112 -0
- package/src/editors/selectize.js +89 -338
- package/src/editors/signature.js +100 -104
- package/src/editors/simplemde.js +103 -0
- package/src/{styles → editors}/starrating.css +11 -2
- package/src/editors/starrating.css.js +3 -0
- package/src/editors/starrating.js +126 -95
- package/src/editors/stepper.js +27 -0
- package/src/editors/string.js +352 -426
- package/src/editors/table.js +486 -410
- package/src/editors/upload.js +297 -131
- package/src/editors/uuid.js +49 -0
- package/src/iconlib.js +22 -27
- package/src/iconlibs/bootstrap.js +28 -0
- package/src/iconlibs/bootstrap2.js +28 -17
- package/src/iconlibs/bootstrap3.js +28 -17
- package/src/iconlibs/fontawesome3.js +28 -17
- package/src/iconlibs/fontawesome4.js +28 -18
- package/src/iconlibs/fontawesome5.js +28 -18
- package/src/iconlibs/foundation2.js +24 -17
- package/src/iconlibs/foundation3.js +28 -17
- package/src/iconlibs/index.js +27 -0
- package/src/iconlibs/jqueryui.js +28 -17
- package/src/iconlibs/materialicons.js +49 -44
- package/src/iconlibs/openiconic.js +28 -0
- package/src/iconlibs/spectre.js +28 -0
- package/src/resolvers.js +135 -0
- package/src/schemaloader.js +639 -0
- package/src/style.css +157 -0
- package/src/style.css.js +3 -0
- package/src/templates/default.js +46 -51
- package/src/templates/ejs.js +8 -10
- package/src/templates/handlebars.js +1 -3
- package/src/templates/hogan.js +7 -9
- package/src/templates/index.js +21 -0
- package/src/templates/lodash.js +6 -8
- package/src/templates/markup.js +6 -8
- package/src/templates/mustache.js +6 -8
- package/src/templates/swig.js +1 -3
- package/src/templates/underscore.js +6 -8
- package/src/theme.js +717 -426
- package/src/themes/barebones.css +35 -0
- package/src/themes/barebones.css.js +3 -0
- package/src/themes/barebones.js +31 -0
- package/src/themes/bootstrap2.js +302 -264
- package/src/themes/bootstrap3.css +53 -0
- package/src/themes/bootstrap3.css.js +3 -0
- package/src/themes/bootstrap3.js +356 -259
- package/src/themes/bootstrap4.css +89 -0
- package/src/themes/bootstrap4.css.js +3 -0
- package/src/themes/bootstrap4.js +744 -234
- package/src/themes/bootstrap5.css +97 -0
- package/src/themes/bootstrap5.css.js +3 -0
- package/src/themes/bootstrap5.js +687 -0
- package/src/themes/foundation.js +539 -465
- package/src/themes/html.css +60 -0
- package/src/themes/html.css.js +3 -0
- package/src/themes/html.js +69 -82
- package/src/themes/index.js +29 -0
- package/src/themes/jqueryui.js +181 -166
- package/src/themes/materialize.js +263 -291
- package/src/themes/spectre.css +208 -0
- package/src/themes/spectre.css.js +3 -0
- package/src/themes/spectre.js +443 -0
- package/src/themes/tailwind.css +303 -0
- package/src/themes/tailwind.css.js +3 -0
- package/src/themes/tailwind.js +469 -0
- package/src/utilities.js +127 -68
- package/src/validator.js +914 -551
- package/src/validators/ip-validator.js +51 -0
- package/tests/Dockerfile +3 -0
- package/tests/README.md +27 -6
- package/tests/codeceptjs/codecept.json +29 -5
- package/tests/codeceptjs/constrains/contains_test.js +37 -0
- package/tests/codeceptjs/constrains/dependentRequired_test.js +33 -0
- package/tests/codeceptjs/constrains/dependentSchemas_test.js +16 -0
- package/tests/codeceptjs/constrains/if-then-else_test.js +186 -0
- package/tests/codeceptjs/core_test.js +534 -68
- package/tests/codeceptjs/editors/advanced_test.js +12 -10
- package/tests/codeceptjs/editors/array_any_of_test.js +50 -0
- package/tests/codeceptjs/editors/array_test.js +935 -677
- package/tests/codeceptjs/editors/autocomplete_test.js +15 -0
- package/tests/codeceptjs/editors/button_test.js +50 -0
- package/tests/codeceptjs/editors/checkbox_test.js +21 -8
- package/tests/codeceptjs/editors/colorpicker_test.js +29 -0
- package/tests/codeceptjs/editors/datetime_test.js +33 -0
- package/tests/codeceptjs/editors/inheritance_test.js +10 -0
- package/tests/codeceptjs/editors/integer_test.js +82 -71
- package/tests/codeceptjs/editors/jodit_test.js +23 -0
- package/tests/codeceptjs/editors/multiple_test.js +27 -0
- package/tests/codeceptjs/editors/multiselect_test.js +6 -9
- package/tests/codeceptjs/editors/number_test.js +75 -67
- package/tests/codeceptjs/editors/object_test.js +337 -28
- package/tests/codeceptjs/editors/option-no_default_values_test.js +42 -0
- package/tests/codeceptjs/editors/programmatic-changes_test.js +20 -0
- package/tests/codeceptjs/editors/purify_test.js +26 -0
- package/tests/codeceptjs/editors/radio_test.js +9 -0
- package/tests/codeceptjs/editors/range_test.js +10 -0
- package/tests/codeceptjs/editors/rating_test.js +10 -16
- package/tests/codeceptjs/editors/select_test.js +46 -23
- package/tests/codeceptjs/editors/starrating_test.js +15 -0
- package/tests/codeceptjs/editors/stepper_test.js +37 -0
- package/tests/codeceptjs/editors/string_test.js +108 -101
- package/tests/codeceptjs/editors/table-confirm-delete_test.js +60 -55
- package/tests/codeceptjs/editors/tabs_test.js +14 -11
- package/tests/codeceptjs/editors/uuid_test.js +48 -0
- package/tests/codeceptjs/editors/validation_test.js +13 -9
- package/tests/codeceptjs/issues/issue-gh-1133_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1158_test.js +8 -0
- package/tests/codeceptjs/issues/issue-gh-1164_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1171_test.js +11 -0
- package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
- package/tests/codeceptjs/issues/issue-gh-1257_test.js +11 -0
- package/tests/codeceptjs/issues/issue-gh-1272_test.js +21 -0
- package/tests/codeceptjs/issues/issue-gh-1330_test.js +8 -0
- package/tests/codeceptjs/issues/issue-gh-1338_test.js +18 -0
- package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
- package/tests/codeceptjs/issues/issue-gh-1364_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-1367_test.js +11 -0
- package/tests/codeceptjs/issues/issue-gh-1383_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1384_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1410_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-1422_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1431_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1439_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1452_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1453_test.js +18 -0
- package/tests/codeceptjs/issues/issue-gh-1461_test.js +14 -0
- package/tests/codeceptjs/issues/issue-gh-1463_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1471_test.js +17 -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/codeceptjs/issues/issue-gh-1559_test.js +15 -0
- package/tests/codeceptjs/issues/issue-gh-1562_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1586_test.js +15 -0
- package/tests/codeceptjs/issues/issue-gh-1636_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
- package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
- package/tests/codeceptjs/meta-schema_test.js +85 -0
- package/tests/codeceptjs/schemaloader_test.js +14 -0
- package/tests/codeceptjs/steps.d.ts +13 -0
- package/tests/codeceptjs/steps_file.js +4 -4
- package/tests/codeceptjs/test-config.js +3 -0
- package/tests/codeceptjs/themes_test.js +564 -0
- package/tests/docker-compose-local.yml +5 -0
- package/tests/docker-compose.yml +23 -17
- package/tests/fixtures/basic_person.json +2 -1
- package/tests/fixtures/definitions.json +22 -0
- package/tests/fixtures/nested_object.json +26 -0
- package/tests/fixtures/properties.json +20 -0
- package/tests/fixtures/some_types.json +32 -0
- package/tests/fixtures/validation.json +1347 -0
- package/tests/pages/_demo.html +475 -0
- package/tests/pages/advanced.html +1 -1
- package/tests/pages/anyof-2.html +91 -0
- package/tests/pages/anyof.html +82 -0
- package/tests/pages/array-anyof.html +145 -0
- package/tests/pages/array-checkboxes-infotext.html +55 -0
- package/tests/pages/array-checkboxes.html +5 -2
- package/tests/pages/array-choices.html +48 -0
- package/tests/pages/array-events-table.html +70 -0
- package/tests/pages/array-events.html +75 -0
- package/tests/pages/array-header-template.html +60 -0
- package/tests/pages/array-integers.html +5 -2
- package/tests/pages/array-multiselects.html +5 -2
- package/tests/pages/array-nested-arrays.html +5 -2
- package/tests/pages/array-numbers.html +5 -2
- package/tests/pages/array-objects.html +5 -2
- package/tests/pages/array-ratings.html +5 -2
- package/tests/pages/array-selectize-create.html +63 -0
- package/tests/pages/array-selectize.html +54 -0
- package/tests/pages/array-selects.html +5 -2
- package/tests/pages/array-strings.html +5 -2
- package/tests/pages/array-table-responsive.html +66 -0
- package/tests/pages/array-unique-items-sort.html +81 -0
- package/tests/pages/array.html +5 -2
- package/tests/pages/assets/autocomplete.css +1 -0
- package/tests/pages/assets/autocomplete.min.js +1 -0
- package/tests/pages/assets/pages.css +130 -0
- package/tests/pages/autocomplete.html +72 -0
- package/tests/pages/button-callbacks.html +79 -0
- package/tests/pages/button-icons.html +39 -0
- package/tests/pages/button_state_mode_1.html +35 -0
- package/tests/pages/button_state_mode_2.html +36 -0
- package/tests/pages/checkbox-labels.html +116 -0
- package/tests/pages/colorpicker-no-3rd-party.html +45 -0
- package/tests/pages/colorpicker-use-vanilla-picker.html +52 -0
- package/tests/pages/container-attributes.html +51 -0
- package/tests/pages/contains.html +39 -0
- package/tests/pages/core.html +14 -7
- package/tests/pages/datetime.html +78 -0
- package/tests/pages/dependentRequired.html +72 -0
- package/tests/pages/dependentSchemas.html +53 -0
- package/tests/pages/disable-button-in-object-editors.html +57 -0
- package/tests/pages/editor-show-validation-errors.html +54 -0
- package/tests/pages/enforce-const.html +168 -0
- package/tests/pages/error-messages.html +48 -0
- package/tests/pages/form-name.html +111 -0
- package/tests/pages/grid-strict.html +308 -0
- package/tests/pages/grid.html +281 -0
- package/tests/pages/if-else.html +58 -0
- package/tests/pages/if-then-else-allOf.html +118 -0
- package/tests/pages/if-then-else-disable-fields.html +70 -0
- package/tests/pages/if-then-else.html +65 -0
- package/tests/pages/if-then.html +58 -0
- package/tests/pages/inheritance.html +80 -0
- package/tests/pages/integer.html +17 -10
- package/tests/pages/issues/_template.html +50 -0
- package/tests/pages/issues/issue-gh-1133.html +64 -0
- package/tests/pages/issues/issue-gh-1158-2.html +189 -0
- package/tests/pages/issues/issue-gh-1158.html +50 -0
- package/tests/pages/issues/issue-gh-1164.html +71 -0
- package/tests/pages/issues/issue-gh-1165.html +63 -0
- package/tests/pages/issues/issue-gh-1165.json +8 -0
- package/tests/pages/issues/issue-gh-1171.html +39 -0
- package/tests/pages/issues/issue-gh-1211.html +1022 -0
- package/tests/pages/issues/issue-gh-1233-failing.html +46 -0
- package/tests/pages/issues/issue-gh-1233-passing.html +49 -0
- package/tests/pages/issues/issue-gh-1257.html +77 -0
- package/tests/pages/issues/issue-gh-1272.html +167 -0
- package/tests/pages/issues/issue-gh-1330.html +52 -0
- package/tests/pages/issues/issue-gh-1338.html +74 -0
- package/tests/pages/issues/issue-gh-1347.html +142 -0
- package/tests/pages/issues/issue-gh-1364.html +64 -0
- package/tests/pages/issues/issue-gh-1367.html +49 -0
- package/tests/pages/issues/issue-gh-1383.html +31 -0
- package/tests/pages/issues/issue-gh-1383.json +14 -0
- package/tests/pages/issues/issue-gh-1384.html +31 -0
- package/tests/pages/issues/issue-gh-1384.json +36 -0
- package/tests/pages/issues/issue-gh-1410.html +57 -0
- package/tests/pages/issues/issue-gh-1422.html +68 -0
- package/tests/pages/issues/issue-gh-1431.html +49 -0
- package/tests/pages/issues/issue-gh-1439.html +69 -0
- package/tests/pages/issues/issue-gh-1452.html +98 -0
- package/tests/pages/issues/issue-gh-1453.html +45 -0
- package/tests/pages/issues/issue-gh-1461.html +55 -0
- package/tests/pages/issues/issue-gh-1463.html +41 -0
- package/tests/pages/issues/issue-gh-1466.html +63 -0
- package/tests/pages/issues/issue-gh-1471.html +49 -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/issues/issue-gh-1559.html +68 -0
- package/tests/pages/issues/issue-gh-1562.html +170 -0
- package/tests/pages/issues/issue-gh-1586.html +48 -0
- package/tests/pages/issues/issue-gh-1636.html +52 -0
- package/tests/pages/issues/issue-gh-795.html +58 -0
- package/tests/pages/issues/issue-gh-810.html +149 -0
- package/tests/pages/issues/issue-gh-812.html +113 -0
- package/tests/pages/issues/issue-gh-823-meta-schema.html +35 -0
- package/tests/pages/issues/issue-gh-848.html +81 -0
- package/tests/pages/keep_only_existing_values.html +81 -0
- package/tests/pages/load-events.html +61 -0
- package/tests/pages/maxContains.html +40 -0
- package/tests/pages/meta-schema.html +793 -0
- package/tests/pages/meta_schema.json +740 -0
- package/tests/pages/minContains.html +40 -0
- package/tests/pages/number.html +53 -6
- package/tests/pages/object-case-sensitive-property-search-false.html +42 -0
- package/tests/pages/object-case-sensitive-property-search-true.html +42 -0
- package/tests/pages/object-no-additional-properties.html +68 -0
- package/tests/pages/object-no-duplicated-id.html +70 -0
- package/tests/pages/object-required-properties.html +261 -0
- package/tests/pages/object-show-opt-in.html +111 -0
- package/tests/pages/object-with-dependencies-array.html +58 -0
- package/tests/pages/object-with-dependencies.html +62 -0
- package/tests/pages/object.html +5 -3
- package/tests/pages/oneof-2.html +91 -0
- package/tests/pages/oneof.html +105 -0
- package/tests/pages/opt-in-widget.html +134 -0
- package/tests/pages/option-dependencies.html +107 -0
- package/tests/pages/option-no_default_values.html +60 -0
- package/tests/pages/per-editor-options.html +44 -0
- package/tests/pages/placeholder-options.html +57 -0
- package/tests/pages/programmatic-changes.html +121 -0
- package/tests/pages/prompt-paste-max-length-reached.html +51 -0
- package/tests/pages/purify.html +66 -0
- package/tests/pages/range.html +62 -0
- package/tests/pages/read-only.html +60 -8
- package/tests/pages/ready.html +44 -0
- package/tests/pages/references.html +168 -0
- package/tests/pages/remove-false-properties.html +85 -0
- package/tests/pages/select-values.html +91 -0
- package/tests/pages/select.html +4 -3
- package/tests/pages/show-validation-errors.html +73 -0
- package/tests/pages/starrating.html +86 -0
- package/tests/pages/stepper-manual.html +59 -0
- package/tests/pages/stepper.html +61 -0
- package/tests/pages/string-ace-editor.html +7 -3
- package/tests/pages/string-cleave.html +48 -0
- package/tests/pages/string-custom-attributes.html +9 -6
- package/tests/pages/string-formats.html +54 -0
- package/tests/pages/string-formats2.html +59 -0
- package/tests/pages/{array-move-events.html → string-jodit-editor.html} +21 -29
- package/tests/pages/string-sceditor.html +9 -7
- package/tests/pages/string-simplemde-editor.html +83 -0
- package/tests/pages/switcher-option.html +69 -0
- package/tests/pages/table.html +4 -2
- package/tests/pages/tabs.html +1 -1
- package/tests/pages/themes.html +517 -0
- package/tests/pages/title-hidden.html +75 -0
- package/tests/pages/translate-property.html +248 -0
- package/tests/pages/urn.html +98 -0
- package/tests/pages/use-name-attributes.html +207 -0
- package/tests/pages/uuid.html +113 -0
- package/tests/pages/validation-messages.json +705 -0
- package/tests/pages/validation.html +20 -730
- package/tests/unit/.eslintrc +8 -0
- package/tests/unit/core.spec.js +320 -0
- package/tests/unit/defaults.spec.js +40 -0
- package/tests/unit/editor.spec.js +172 -0
- package/tests/unit/editors/array.spec.js +87 -0
- package/tests/unit/editors/object.spec.js +81 -0
- package/tests/unit/editors/table.spec.js +93 -0
- package/tests/unit/readme.md +35 -0
- package/tests/unit/schemaloader.spec.js +576 -0
- package/tests/unit/validator.spec.js +104 -0
- package/tests/unit/validators/ip-validator.spec.js +62 -0
- package/Gruntfile.js +0 -226
- package/dist/css/jsoneditor.min.css +0 -1
- package/dist/jsoneditor.js.map +0 -1
- package/dist/jsoneditor.min.js +0 -19
- package/dist/jsoneditor.min.js.map +0 -1
- package/docs/demo.html +0 -646
- package/src/class.js +0 -68
- package/src/editors/rating.js +0 -152
- package/src/ie9.js +0 -51
- package/src/intro.js +0 -23
- package/src/jquery.js +0 -64
- package/src/outro.js +0 -2
- package/src/themes/jsoneditor.barebones-theme.js +0 -60
package/README.md
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
JSON Editor
|
|
2
2
|
===========
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
> **🔧 Maintenance Mode Notice**
|
|
5
|
+
>
|
|
6
|
+
> This library is now in maintenance mode. While it remains stable and functional, active development has moved to [Jedison](https://github.com/germanbisurgi/jedison).
|
|
7
|
+
>
|
|
8
|
+
> We will continue to:
|
|
9
|
+
> - Accept and review community pull requests
|
|
10
|
+
> - Address critical bugs and security issues
|
|
11
|
+
> - Keep the library functional for existing users
|
|
12
|
+
>
|
|
13
|
+
> For new projects or those seeking active development, consider using [Jedison](https://github.com/germanbisurgi/jedison).
|
|
14
|
+
|
|
15
|
+
[](https://github.com/json-editor/json-editor/actions)
|
|
16
|
+
|
|
17
|
+
Fork of the inactive [jdorn/json-editor](https://github.com/jdorn/json-editor) using the updated fork [json-editor/json-editor](https://github.com/json-editor/json-editor).
|
|
6
18
|
Some pull requests added from the original repo.
|
|
7
19
|
|
|
8
20
|

|
|
9
21
|
|
|
10
|
-
JSON Editor takes a JSON Schema and uses it to generate an HTML form.
|
|
11
|
-
It has full support for JSON Schema version 3 and 4 and can integrate with several popular CSS frameworks (bootstrap,
|
|
22
|
+
JSON Editor takes a JSON Schema and uses it to generate an HTML form.
|
|
23
|
+
It has full support for JSON Schema version 3 and 4 and can integrate with several popular CSS frameworks (bootstrap, spectre, tailwind).
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
Take a look at this [example](https://json-editor.github.io/json-editor/form-submission.html) for a simple form submission case study.
|
|
26
|
+
### Online Demo
|
|
27
|
+
|
|
28
|
+
Check out an interactive demo: https://json-editor.github.io/json-editor/
|
|
29
|
+
|
|
30
|
+
Or the JSON-Editor Interactive Playground: https://pmk65.github.io/jedemov2/dist/demo.html
|
|
14
31
|
|
|
15
32
|
Install
|
|
16
33
|
-----------------
|
|
@@ -25,7 +42,7 @@ Using a CDN
|
|
|
25
42
|
|
|
26
43
|
You can also access older releases from CDN, using the landing page: https://www.jsdelivr.com/package/npm/@json-editor/json-editor
|
|
27
44
|
|
|
28
|
-
For local usage download the [production version](https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.
|
|
45
|
+
For local usage download the [production version](https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.js) or the [development version](https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/nonmin/jsoneditor.js)
|
|
29
46
|
|
|
30
47
|
Requirements
|
|
31
48
|
-----------------
|
|
@@ -37,47 +54,60 @@ JSON Editor has no dependencies. It only needs a modern browser (tested in Chrom
|
|
|
37
54
|
The following are not required, but can improve the style and usability of JSON Editor when present.
|
|
38
55
|
|
|
39
56
|
* A compatible JS template engine (Mustache, Underscore, Hogan, Handlebars, Lodash, Swig, Markup, or EJS)
|
|
40
|
-
* A compatible CSS framework for styling (
|
|
41
|
-
* A compatible icon library (
|
|
57
|
+
* A compatible CSS framework for styling (Spectre, Tailwind, Bootstrap4)
|
|
58
|
+
* A compatible icon library (Spectre, jQueryUI, Font Awesome 3/4/5)
|
|
42
59
|
* [SCEditor](http://www.sceditor.com/) for WYSIWYG editing of HTML or BBCode content
|
|
43
60
|
* [SimpleMDE](https://simplemde.com/) for editing of Markdown content
|
|
44
61
|
* [Ace Editor](http://ace.c9.io/) for editing code
|
|
62
|
+
* [Jodit](https://xdsoft.net/jodit/) Open Source WYSIWYG editor
|
|
63
|
+
* [Autocomplete](https://autocomplete.trevoreyre.com/#/javascript-component) Accessible autocomplete component
|
|
64
|
+
* [Choices](https://github.com/jshjohnson/Choices) for nicer Select & Array boxes
|
|
45
65
|
* [Select2](http://ivaynberg.github.io/select2/) for nicer Select boxes
|
|
46
66
|
* [Selectize](https://selectize.github.io/selectize.js/) for nicer Select & Array boxes
|
|
47
67
|
* [Flatpickr](https://flatpickr.js.org/) lightweight and powerful datetime picker
|
|
48
68
|
* [Signature Pad](https://github.com/szimek/signature_pad) HTML5 canvas based smooth signature drawing
|
|
69
|
+
* [Vanilla Picker](https://vanilla-picker.js.org/) A simple, easy to use vanilla JS color picker with alpha selection
|
|
49
70
|
* [Cleave.js](https://github.com/nosir/cleave.js) for formatting your **<input/>** content while you are typing
|
|
71
|
+
* [IMask.js](https://imask.js.org/) vanilla javascript input mask
|
|
50
72
|
* [math.js](http://mathjs.org/) for more accurate floating point math (multipleOf, divisibleBy, etc.)
|
|
73
|
+
* [DOMPurify](https://github.com/cure53/DOMPurify) DOM-only, super-fast, uber-tolerant XSS sanitizer. (If you want to use HTML format in titles/headers and descriptions.)
|
|
51
74
|
|
|
52
75
|
Usage
|
|
53
76
|
--------------
|
|
54
77
|
|
|
55
78
|
If you learn best by example, check these out:
|
|
56
79
|
|
|
57
|
-
* Basic Usage Example -
|
|
58
|
-
* ACE Editor Example -
|
|
59
|
-
* Advanced Usage Example -
|
|
60
|
-
* CSS Integration Example -
|
|
61
|
-
* Base64 Editor Example (Muiltple Upload) -
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
|
|
80
|
+
* Basic Usage Example - https://json-editor.github.io/json-editor/basic.html
|
|
81
|
+
* ACE Editor Example - https://json-editor.github.io/json-editor/ace_editor.html
|
|
82
|
+
* Advanced Usage Example - https://json-editor.github.io/json-editor/advanced.html
|
|
83
|
+
* CSS Integration Example - https://json-editor.github.io/json-editor/css_integration.html
|
|
84
|
+
* Base64 Editor Example (Muiltple Upload) - https://json-editor.github.io/json-editor/multiple_upload_base64.html
|
|
85
|
+
* Choices Editor Example - https://json-editor.github.io/json-editor/choices.html
|
|
86
|
+
* Cleave.js Editor Example - https://json-editor.github.io/json-editor/cleave.html
|
|
87
|
+
* Colorpicker Editor Example - https://json-editor.github.io/json-editor/colorpicker.html
|
|
88
|
+
* Datetime Editor Example - https://json-editor.github.io/json-editor/datetime.html
|
|
89
|
+
* DescribedBy Hyperlink Editor Example - https://json-editor.github.io/json-editor/describedby.html
|
|
90
|
+
* iMask.js Editor Example - https://json-editor.github.io/json-editor/imask.html
|
|
91
|
+
* Radio Button JSON Editor Example - https://json-editor.github.io/json-editor/radio.html
|
|
92
|
+
* Recursive JSON Editor Example - https://json-editor.github.io/json-editor/recursive.html
|
|
93
|
+
* Select2 Editor Example - https://json-editor.github.io/json-editor/select2.html
|
|
94
|
+
* Selectize Editor Example - https://json-editor.github.io/json-editor/selectize.html
|
|
95
|
+
* Signature Pad Editor Example - https://json-editor.github.io/json-editor/signature.html
|
|
96
|
+
* Star Rating Editor Example - https://json-editor.github.io/json-editor/starrating.html
|
|
97
|
+
* Upload Editor Example - https://json-editor.github.io/json-editor/upload.html
|
|
98
|
+
* WYSIWYG Editor Example - https://json-editor.github.io/json-editor/wysiwyg.html
|
|
99
|
+
* Meta schema (schema builder) Example - https://json-editor.github.io/json-editor/meta-schema.html
|
|
100
|
+
|
|
101
|
+
More examples can be found at the [JSON-Editor Interactive Playground](https://pmk65.github.io/jedemov2/dist/demo.html)
|
|
72
102
|
|
|
73
103
|
The rest of this README contains detailed documentation about every aspect of JSON Editor. For more [under-the-hood documentation](https://github.com/json-editor/json-editor/wiki), check the wiki.
|
|
74
104
|
|
|
75
105
|
### Initialize
|
|
76
106
|
|
|
77
107
|
```js
|
|
78
|
-
|
|
108
|
+
const element = document.getElementById('editor_holder');
|
|
79
109
|
|
|
80
|
-
|
|
110
|
+
const editor = new JSONEditor(element, options);
|
|
81
111
|
```
|
|
82
112
|
|
|
83
113
|
#### Options
|
|
@@ -86,12 +116,12 @@ Options can be set globally or on a per-instance basis during instantiation.
|
|
|
86
116
|
|
|
87
117
|
```js
|
|
88
118
|
// Set an option globally
|
|
89
|
-
JSONEditor.defaults.options.theme = '
|
|
119
|
+
JSONEditor.defaults.options.theme = 'bootstrap4';
|
|
90
120
|
|
|
91
121
|
// Set an option during instantiation
|
|
92
|
-
|
|
122
|
+
const editor = new JSONEditor(element, {
|
|
93
123
|
//...
|
|
94
|
-
theme: '
|
|
124
|
+
theme: 'bootstrap4'
|
|
95
125
|
});
|
|
96
126
|
```
|
|
97
127
|
|
|
@@ -111,6 +141,26 @@ Here are all the available options:
|
|
|
111
141
|
<td>If <code>true</code>, JSON Editor will load external URLs in <code>$ref</code> via ajax.</td>
|
|
112
142
|
<td><code>false</code></td>
|
|
113
143
|
</tr>
|
|
144
|
+
<tr>
|
|
145
|
+
<td>ajaxBase</td>
|
|
146
|
+
<td>Allows schema references to work either with or without cors; set to protocol://host:port when api is served by different host.</td>
|
|
147
|
+
<td><code></code></td>
|
|
148
|
+
</tr>
|
|
149
|
+
<tr>
|
|
150
|
+
<td>ajaxCredentials</td>
|
|
151
|
+
<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>
|
|
152
|
+
<td><code>false</code></td>
|
|
153
|
+
</tr>
|
|
154
|
+
<tr>
|
|
155
|
+
<td>ajax_cache_responses</td>
|
|
156
|
+
<td>If <code>true</code>, JSON Editor will cache external URLs' schemas in <code>localStorage</code> to avoid subsequent ajax calls.</td>
|
|
157
|
+
<td><code>false</code></td>
|
|
158
|
+
</tr>
|
|
159
|
+
<tr>
|
|
160
|
+
<td>ajax_cache_buster</td>
|
|
161
|
+
<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>
|
|
162
|
+
<td>Current date in simplied ISO-8601 format (e.g., "2011-10-05" for October 5, 2011).</td>
|
|
163
|
+
</tr>
|
|
114
164
|
<tr>
|
|
115
165
|
<td>compact</td>
|
|
116
166
|
<td>If <code>true</code>, the label will not be displayed/added.</td>
|
|
@@ -126,6 +176,16 @@ Here are all the available options:
|
|
|
126
176
|
<td>If <code>true</code>, remove all "delete row" buttons from arrays.</td>
|
|
127
177
|
<td><code>false</code></td>
|
|
128
178
|
</tr>
|
|
179
|
+
<tr>
|
|
180
|
+
<td>disable_array_delete_all_rows</td>
|
|
181
|
+
<td>If <code>true</code>, remove all "delete all rows" buttons from arrays.</td>
|
|
182
|
+
<td><code>false</code></td>
|
|
183
|
+
</tr>
|
|
184
|
+
<tr>
|
|
185
|
+
<td>disable_array_delete_last_row</td>
|
|
186
|
+
<td>If <code>true</code>, remove all "delete last row" buttons from arrays.</td>
|
|
187
|
+
<td><code>false</code></td>
|
|
188
|
+
</tr>
|
|
129
189
|
<tr>
|
|
130
190
|
<td>disable_array_reorder</td>
|
|
131
191
|
<td>If <code>true</code>, remove all "move up" and "move down" buttons from arrays.</td>
|
|
@@ -167,9 +227,14 @@ Here are all the available options:
|
|
|
167
227
|
<td>The icon library to use for the editor. See the <strong>CSS Integration</strong> section below for more info.</td>
|
|
168
228
|
<td><code>null</code></td>
|
|
169
229
|
</tr>
|
|
230
|
+
<tr>
|
|
231
|
+
<td>remove_button_labels</td>
|
|
232
|
+
<td>Display only icons in buttons. This works only if iconlib is set.</td>
|
|
233
|
+
<td><code>false</code></td>
|
|
234
|
+
</tr>
|
|
170
235
|
<tr>
|
|
171
236
|
<td>no_additional_properties</td>
|
|
172
|
-
<td>If <code>true</code>, objects can only contain properties defined with the <code>properties</code> keyword
|
|
237
|
+
<td>If <code>true</code>, objects can only contain properties defined with the <code>properties</code> keyword unless the property <code>additionalProperties: true</code> is specified in the object schema</td>
|
|
173
238
|
<td><code>false</code></td>
|
|
174
239
|
</tr>
|
|
175
240
|
<tr>
|
|
@@ -187,6 +252,11 @@ Here are all the available options:
|
|
|
187
252
|
<td>If <code>true</code>, makes oneOf copy properties over when switching.</td>
|
|
188
253
|
<td><code>true</code></td>
|
|
189
254
|
</tr>
|
|
255
|
+
<tr>
|
|
256
|
+
<td>keep_only_existing_values</td>
|
|
257
|
+
<td>If <code>true</code>, copy only existing properties over when switching.</td>
|
|
258
|
+
<td><code>false</code></td>
|
|
259
|
+
</tr>
|
|
190
260
|
<tr>
|
|
191
261
|
<td>schema</td>
|
|
192
262
|
<td>A valid JSON Schema to use for the editor. Version 3 and Version 4 of the draft specification are supported.</td>
|
|
@@ -217,11 +287,71 @@ Here are all the available options:
|
|
|
217
287
|
<td>If <code>true</code>, only required properties will be included by default.</td>
|
|
218
288
|
<td><code>false</code></td>
|
|
219
289
|
</tr>
|
|
290
|
+
<tr>
|
|
291
|
+
<td>show_opt_in</td>
|
|
292
|
+
<td>If <code>true</code>, NON required properties will have an extra toggable checkbox near the title that determines if the value must be included or not in the editor´s value</td>
|
|
293
|
+
<td><code>false</code></td>
|
|
294
|
+
</tr>
|
|
220
295
|
<tr>
|
|
221
296
|
<td>prompt_before_delete</td>
|
|
222
297
|
<td>If <code>true</code>, displays a dialog box with a confirmation message before node deletion.</td>
|
|
223
298
|
<td><code>true</code></td>
|
|
224
299
|
</tr>
|
|
300
|
+
<tr>
|
|
301
|
+
<td>object_layout</td>
|
|
302
|
+
<td>The default value of `format` for objects. If set to <code>table</code> for example, objects will use table layout if `format` is not specified.</td>
|
|
303
|
+
<td><code>normal</code></td>
|
|
304
|
+
</tr>
|
|
305
|
+
<tr>
|
|
306
|
+
<td>enum_source_value_auto_select</td>
|
|
307
|
+
<td>Preserve value at Move Up or Down.(No value is selected automatically upon deletion.)</td>
|
|
308
|
+
<td><code>true</code></td>
|
|
309
|
+
</tr>
|
|
310
|
+
<tr>
|
|
311
|
+
<td>max_depth</td>
|
|
312
|
+
<td>Max depth of the nested properties to be rendered of provided json schema. The missing of this option could cause "maximum call stack size exceeded" in case of object properties with circular references. <code>0</code> value means "render all".</td>
|
|
313
|
+
<td><code>0</code></td>
|
|
314
|
+
</tr>
|
|
315
|
+
<tr>
|
|
316
|
+
<td>use_default_values</td>
|
|
317
|
+
<td>If true default values based on the "type" of the property will be used</td>
|
|
318
|
+
<td><code>true</code></td>
|
|
319
|
+
</tr>
|
|
320
|
+
<tr>
|
|
321
|
+
<td>urn_resolver</td>
|
|
322
|
+
<td>A callback function to resolve an undefined Uniform Resource Name (URN) for <code>$ref</code>. The function receives a URN and callback to pass back a serialized JSON response. The function should return a boolean (true if the URN can be resolved; false otherwise).</td>
|
|
323
|
+
<td><code>false</code></td>
|
|
324
|
+
</tr>
|
|
325
|
+
<tr>
|
|
326
|
+
<td>use_name_attributes</td>
|
|
327
|
+
<td>If <code>true</code>, control inputs <code>name</code> attributes will be set.</td>
|
|
328
|
+
<td><code>true</code></td>
|
|
329
|
+
</tr>
|
|
330
|
+
<tr>
|
|
331
|
+
<td>button_state_mode</td>
|
|
332
|
+
<td>If <code>1</code>, inactive buttons are hidden. If <code>2</code>, inactive buttons are disabled.</td>
|
|
333
|
+
<td><code>1</code></td>
|
|
334
|
+
</tr>
|
|
335
|
+
<tr>
|
|
336
|
+
<td>case_sensitive_property_search</td>
|
|
337
|
+
<td>This property controls whether property searches in an object editor are case-sensitive</td>
|
|
338
|
+
<td><code>true</code></td>
|
|
339
|
+
</tr>
|
|
340
|
+
<tr>
|
|
341
|
+
<td>prompt_paste_max_length_reached</td>
|
|
342
|
+
<td>If <code>true</code>, an alert will be displayed when pasting a value in an input that exceeded maxLength</td>
|
|
343
|
+
<td><code>false</code></td>
|
|
344
|
+
</tr>
|
|
345
|
+
<tr>
|
|
346
|
+
<td>enforce_const</td>
|
|
347
|
+
<td>When set to <code>true</code>, the schema <code>const</code> will serve as the default value, and the editor will prevent any changes to it.</td>
|
|
348
|
+
<td><code>false</code></td>
|
|
349
|
+
</tr>
|
|
350
|
+
<tr>
|
|
351
|
+
<td>opt_in_widget</td>
|
|
352
|
+
<td>Which widget should be used for opt-in inputs. Possible values are <code>'checkbox'</code> and <code>'switch'</code></td>
|
|
353
|
+
<td><code>'checkbox'</code></td>
|
|
354
|
+
</tr>
|
|
225
355
|
</tbody>
|
|
226
356
|
</table>
|
|
227
357
|
|
|
@@ -229,7 +359,7 @@ __*Note__ If the `ajax` property is `true` and JSON Editor needs to fetch an ext
|
|
|
229
359
|
Listen for the `ready` event before calling them.
|
|
230
360
|
|
|
231
361
|
```js
|
|
232
|
-
editor.on('ready',
|
|
362
|
+
editor.on('ready',() => {
|
|
233
363
|
// Now the api methods will be available
|
|
234
364
|
editor.validate();
|
|
235
365
|
});
|
|
@@ -240,7 +370,7 @@ editor.on('ready',function() {
|
|
|
240
370
|
```js
|
|
241
371
|
editor.setValue({name: "John Smith"});
|
|
242
372
|
|
|
243
|
-
|
|
373
|
+
const value = editor.getValue();
|
|
244
374
|
console.log(value.name) // Will log "John Smith"
|
|
245
375
|
```
|
|
246
376
|
|
|
@@ -248,17 +378,16 @@ Instead of getting/setting the value of the entire editor, you can also work on
|
|
|
248
378
|
|
|
249
379
|
```js
|
|
250
380
|
// Get a reference to a node within the editor
|
|
251
|
-
|
|
381
|
+
const name = editor.getEditor('root.name');
|
|
252
382
|
|
|
253
383
|
// `getEditor` will return null if the path is invalid
|
|
254
|
-
if(name) {
|
|
384
|
+
if (name) {
|
|
255
385
|
name.setValue("John Smith");
|
|
256
386
|
|
|
257
387
|
console.log(name.getValue());
|
|
258
388
|
}
|
|
259
389
|
```
|
|
260
390
|
|
|
261
|
-
|
|
262
391
|
### Validate
|
|
263
392
|
|
|
264
393
|
When feasible, JSON Editor won't let users enter invalid data. This is done by
|
|
@@ -270,9 +399,9 @@ You can use the `validate` method to check if the data is valid or not.
|
|
|
270
399
|
|
|
271
400
|
```javascript
|
|
272
401
|
// Validate the editor's current value against the schema
|
|
273
|
-
|
|
402
|
+
const errors = editor.validate();
|
|
274
403
|
|
|
275
|
-
if(errors.length) {
|
|
404
|
+
if (errors.length) {
|
|
276
405
|
// errors is an array of objects, each with a `path`, `property`, and `message` parameter
|
|
277
406
|
// `property` is the schema keyword that triggered the validation error (e.g. "minLength")
|
|
278
407
|
// `path` is a dot separated path into the JSON object (e.g. "root.path.to.field")
|
|
@@ -289,19 +418,25 @@ If you want to use a different value, you can pass it in as a parameter.
|
|
|
289
418
|
|
|
290
419
|
```javascript
|
|
291
420
|
// Validate an arbitrary value against the editor's schema
|
|
292
|
-
|
|
421
|
+
const errors = editor.validate({
|
|
293
422
|
value: {
|
|
294
423
|
to: "test"
|
|
295
424
|
}
|
|
296
425
|
});
|
|
297
426
|
```
|
|
298
427
|
|
|
428
|
+
Display validation errors on demand
|
|
429
|
+
|
|
430
|
+
```javascript
|
|
431
|
+
editor.showValidationErrors();
|
|
432
|
+
```
|
|
433
|
+
|
|
299
434
|
### Listen for Changes
|
|
300
435
|
|
|
301
436
|
The `change` event is fired whenever the editor's value changes.
|
|
302
437
|
|
|
303
438
|
```javascript
|
|
304
|
-
editor.on('change',
|
|
439
|
+
editor.on('change',() => {
|
|
305
440
|
// Do something
|
|
306
441
|
});
|
|
307
442
|
|
|
@@ -311,7 +446,7 @@ editor.off('change',function_reference);
|
|
|
311
446
|
You can also watch a specific field for changes:
|
|
312
447
|
|
|
313
448
|
```javascript
|
|
314
|
-
editor.watch('path.to.field',
|
|
449
|
+
editor.watch('path.to.field',() => {
|
|
315
450
|
// Do something
|
|
316
451
|
});
|
|
317
452
|
|
|
@@ -321,17 +456,34 @@ editor.unwatch('path.to.field',function_reference);
|
|
|
321
456
|
Or watch all fields (Similar to the "onchange" event, but tracks the field changed)
|
|
322
457
|
|
|
323
458
|
```javascript
|
|
324
|
-
|
|
325
|
-
console.log(
|
|
459
|
+
const watcherCallback = function (path) {
|
|
460
|
+
console.log(`field with path: [${path}] changed to [${JSON.stringify(this.getEditor(path).getValue())}]`);
|
|
326
461
|
// Do something
|
|
327
462
|
}
|
|
328
|
-
for (
|
|
463
|
+
for (let key in editor.editors) {
|
|
329
464
|
if (editor.editors.hasOwnProperty(key) && key !== 'root') {
|
|
330
465
|
editor.watch(key, watcherCallback.bind(editor, key));
|
|
331
466
|
}
|
|
332
467
|
}
|
|
333
468
|
```
|
|
334
469
|
|
|
470
|
+
There are also `add` and `switch` events to track changes.
|
|
471
|
+
The `add` event fires when a new object property has just been added.
|
|
472
|
+
|
|
473
|
+
```javascript
|
|
474
|
+
editor.on('add',(property) => {
|
|
475
|
+
// Do something
|
|
476
|
+
});
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
The `switch` event fires when the type of one of the object's properties is changed by a type switch on the form.
|
|
480
|
+
|
|
481
|
+
```javascript
|
|
482
|
+
editor.on('switch',(property) => {
|
|
483
|
+
// Do something
|
|
484
|
+
});
|
|
485
|
+
```
|
|
486
|
+
|
|
335
487
|
### Enable and Disable the Editor
|
|
336
488
|
|
|
337
489
|
This lets you disable editing for the entire form or part of the form.
|
|
@@ -351,6 +503,12 @@ editor.getEditor('root.location').enable();
|
|
|
351
503
|
|
|
352
504
|
// Check if form is currently enabled
|
|
353
505
|
if(editor.isEnabled()) alert("It's editable!");
|
|
506
|
+
|
|
507
|
+
// Activate part of the form
|
|
508
|
+
editor.activate();
|
|
509
|
+
|
|
510
|
+
// Deactivate part of the form
|
|
511
|
+
editor.deactivate();
|
|
354
512
|
```
|
|
355
513
|
|
|
356
514
|
### Destroy
|
|
@@ -369,9 +527,16 @@ The currently supported themes are:
|
|
|
369
527
|
|
|
370
528
|
* barebones
|
|
371
529
|
* html (the default)
|
|
372
|
-
* bootstrap2
|
|
373
530
|
* bootstrap3
|
|
374
531
|
* bootstrap4
|
|
532
|
+
* bootstrap5
|
|
533
|
+
* spectre
|
|
534
|
+
* tailwind
|
|
535
|
+
|
|
536
|
+
Note: The following themes have NOT been updated to 2.x format and will be removed in final version unless there's someone willing to update those.
|
|
537
|
+
Old 1.x themes displays the message **"This is an old JSON-Editor 1.x Theme and might not display elements correctly when used with the 2.x version"** at the bottom of the form output.
|
|
538
|
+
|
|
539
|
+
* bootstrap2
|
|
375
540
|
* foundation3
|
|
376
541
|
* foundation4
|
|
377
542
|
* foundation5
|
|
@@ -385,15 +550,15 @@ This default can be changed by setting the `JSONEditor.defaults.options.theme` v
|
|
|
385
550
|
If you want to specify your own styles with CSS, you can use `barebones`, which includes almost no classes or inline styles.
|
|
386
551
|
|
|
387
552
|
```javascript
|
|
388
|
-
JSONEditor.defaults.options.theme = '
|
|
553
|
+
JSONEditor.defaults.options.theme = 'spectre';
|
|
389
554
|
```
|
|
390
555
|
|
|
391
556
|
You can override this default on a per-instance basis by passing a `theme` parameter in when initializing:
|
|
392
557
|
|
|
393
558
|
```js
|
|
394
|
-
|
|
559
|
+
const editor = new JSONEditor(element,{
|
|
395
560
|
schema: schema,
|
|
396
|
-
theme: '
|
|
561
|
+
theme: 'tailwind'
|
|
397
562
|
});
|
|
398
563
|
```
|
|
399
564
|
|
|
@@ -403,24 +568,22 @@ JSON Editor also supports several popular icon libraries. The icon library must
|
|
|
403
568
|
|
|
404
569
|
The supported icon libs are:
|
|
405
570
|
|
|
406
|
-
* bootstrap2 (glyphicons)
|
|
407
|
-
* bootstrap3 (glyphicons)
|
|
408
|
-
* foundation2
|
|
409
|
-
* foundation3
|
|
410
571
|
* jqueryui
|
|
411
572
|
* fontawesome3
|
|
412
573
|
* fontawesome4
|
|
413
574
|
* fontawesome5
|
|
414
|
-
*
|
|
575
|
+
* openiconic
|
|
576
|
+
* spectre
|
|
577
|
+
* bootstrap
|
|
415
578
|
|
|
416
579
|
By default, no icons are used. Just like the CSS theme, you can set the icon lib globally or when initializing:
|
|
417
580
|
|
|
418
581
|
```js
|
|
419
582
|
// Set the global default
|
|
420
|
-
JSONEditor.defaults.options.iconlib = "
|
|
583
|
+
JSONEditor.defaults.options.iconlib = "spectre";
|
|
421
584
|
|
|
422
585
|
// Set the icon lib during initialization
|
|
423
|
-
|
|
586
|
+
const editor = new JSONEditor(element,{
|
|
424
587
|
schema: schema,
|
|
425
588
|
iconlib: "fontawesome4"
|
|
426
589
|
});
|
|
@@ -432,16 +595,16 @@ It's possible to create your own custom themes and/or icon libs as well. Look a
|
|
|
432
595
|
JSON Schema Support
|
|
433
596
|
-----------------
|
|
434
597
|
|
|
435
|
-
JSON Editor fully supports version 3 and 4 of the JSON Schema [core][core] and [validation][validation] specifications.
|
|
598
|
+
JSON Editor fully supports version 3 and 4 of the JSON Schema [core][core] and [validation][validation] specifications.
|
|
436
599
|
Some of The [hyper-schema][hyper] specification is supported as well.
|
|
437
600
|
|
|
438
601
|
[core]: http://json-schema.org/latest/json-schema-core.html
|
|
439
602
|
[validation]: http://json-schema.org/latest/json-schema-validation.html
|
|
440
|
-
[hyper]:
|
|
603
|
+
[hyper]: https://json-schema.org/draft-07/json-hyper-schema-release-notes
|
|
441
604
|
|
|
442
605
|
### $ref and definitions
|
|
443
606
|
|
|
444
|
-
JSON Editor supports schema references to external URLs and local definitions. Here's an example
|
|
607
|
+
JSON Editor supports schema references to external URLs and local definitions as well as JSON Pointers. Here's an example:
|
|
445
608
|
|
|
446
609
|
```json
|
|
447
610
|
{
|
|
@@ -453,6 +616,9 @@ JSON Editor supports schema references to external URLs and local definitions.
|
|
|
453
616
|
},
|
|
454
617
|
"location": {
|
|
455
618
|
"$ref": "http://mydomain.com/geo.json"
|
|
619
|
+
},
|
|
620
|
+
"birthday": {
|
|
621
|
+
"$ref": "http://mydomain.com/person.json#/definitions/birthdate"
|
|
456
622
|
}
|
|
457
623
|
},
|
|
458
624
|
"definitions": {
|
|
@@ -476,8 +642,8 @@ Self-referential $refs are supported. Check out `examples/recursive.html` for u
|
|
|
476
642
|
|
|
477
643
|
The `links` keyword from the hyper-schema specification can be used to add links to related documents.
|
|
478
644
|
|
|
479
|
-
JSON Editor will use the `mediaType` property of the links to determine how best to display them.
|
|
480
|
-
Image, audio, and video links will display the media inline as well as providing a text link.
|
|
645
|
+
JSON Editor will use the `mediaType` property of the links to determine how best to display them.
|
|
646
|
+
Image, audio, and video links will display the media inline as well as providing a text link.
|
|
481
647
|
|
|
482
648
|
Here are a couple examples:
|
|
483
649
|
|
|
@@ -530,6 +696,52 @@ Show a video preview (using HTML5 video)
|
|
|
530
696
|
The `href` property is a template that gets re-evaluated every time the value changes.
|
|
531
697
|
The variable `self` is always available. Look at the __Dependencies__ section below for how to include other fields or use a custom template engine.
|
|
532
698
|
|
|
699
|
+
### if-then-else
|
|
700
|
+
The if-then-else keywords are used to express conditional validation logic based on the evaluation of a specified condition. The if keyword defines a condition, and depending on whether it evaluates to true or false, the schema specified under either the then or else keywords will be applied.
|
|
701
|
+
|
|
702
|
+
```json
|
|
703
|
+
{
|
|
704
|
+
"type": "object",
|
|
705
|
+
"properties": {
|
|
706
|
+
"street_address": {
|
|
707
|
+
"type": "string"
|
|
708
|
+
},
|
|
709
|
+
"country": {
|
|
710
|
+
"type": "string",
|
|
711
|
+
"default": "United States of America",
|
|
712
|
+
"enum": [
|
|
713
|
+
"United States of America",
|
|
714
|
+
"Canada"
|
|
715
|
+
]
|
|
716
|
+
},
|
|
717
|
+
"postal_code": {
|
|
718
|
+
"type": "string"
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
"if": {
|
|
722
|
+
"properties": {
|
|
723
|
+
"country": {
|
|
724
|
+
"const": "United States of America"
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
"then": {
|
|
729
|
+
"properties": {
|
|
730
|
+
"postal_code": {
|
|
731
|
+
"pattern": "[0-9]{5}(-[0-9]{4})?"
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
"else": {
|
|
736
|
+
"properties": {
|
|
737
|
+
"postal_code": {
|
|
738
|
+
"pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]"
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
533
745
|
### Property Ordering
|
|
534
746
|
|
|
535
747
|
There is no way to specify property ordering in JSON Schema (although this may change in v5 of the spec).
|
|
@@ -596,7 +808,6 @@ JSON Editor uses HTML5 input types, so some of these may render as basic text in
|
|
|
596
808
|
|
|
597
809
|
* color
|
|
598
810
|
* date
|
|
599
|
-
* datetime
|
|
600
811
|
* datetime-local
|
|
601
812
|
* email
|
|
602
813
|
* month
|
|
@@ -626,7 +837,8 @@ Here is an example that will show a color picker in browsers that support it:
|
|
|
626
837
|
|
|
627
838
|
#### String Editors Input Attributes
|
|
628
839
|
|
|
629
|
-
You can set custom attributes such as **placeholder**, **class** and **data-** on the input field
|
|
840
|
+
You can set custom attributes such as **placeholder**, **class** and **data-** on the input field and on the editor container
|
|
841
|
+
using the special options keyword `inputAttributes` and `containerAttributes`.
|
|
630
842
|
|
|
631
843
|
Like this:
|
|
632
844
|
|
|
@@ -640,6 +852,10 @@ Like this:
|
|
|
640
852
|
"inputAttributes": {
|
|
641
853
|
"placeholder": "your name here...",
|
|
642
854
|
"class": "myclass"
|
|
855
|
+
},
|
|
856
|
+
"containerAttributes": {
|
|
857
|
+
"data-container": "my-container",
|
|
858
|
+
"class": "my-container-class"
|
|
643
859
|
}
|
|
644
860
|
}
|
|
645
861
|
}
|
|
@@ -651,23 +867,18 @@ Like this:
|
|
|
651
867
|
|
|
652
868
|
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.
|
|
653
869
|
|
|
654
|
-
__SCEditor__ provides WYSIWYG editing of HTML and BBCode. To use it, set the format to `
|
|
870
|
+
__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`:
|
|
655
871
|
|
|
656
872
|
```json
|
|
657
873
|
{
|
|
658
874
|
"type": "string",
|
|
659
|
-
"format": "
|
|
875
|
+
"format": "xhtml",
|
|
660
876
|
"options": {
|
|
661
877
|
"wysiwyg": true
|
|
662
878
|
}
|
|
663
879
|
}
|
|
664
880
|
```
|
|
665
881
|
|
|
666
|
-
You can configure SCEditor by setting configuration options in `JSONEditor.plugins.sceditor`. Here's an example:
|
|
667
|
-
|
|
668
|
-
```js
|
|
669
|
-
JSONEditor.plugins.sceditor.emoticonsEnabled = false;
|
|
670
|
-
```
|
|
671
882
|
|
|
672
883
|
__SimpleMDE__ is a simple Markdown editor with live preview. To use it, set the format to `markdown`:
|
|
673
884
|
|
|
@@ -678,6 +889,33 @@ __SimpleMDE__ is a simple Markdown editor with live preview. To use it, set the
|
|
|
678
889
|
}
|
|
679
890
|
```
|
|
680
891
|
|
|
892
|
+
To customize the editor, add the [configuration](https://github.com/sparksuite/simplemde-markdown-editor#configuration) in the `simplemde` option:
|
|
893
|
+
|
|
894
|
+
```json
|
|
895
|
+
{
|
|
896
|
+
"type": "string",
|
|
897
|
+
"format": "markdown",
|
|
898
|
+
"options": {
|
|
899
|
+
"simplemde": {
|
|
900
|
+
"toolbar": [
|
|
901
|
+
"bold",
|
|
902
|
+
"italic",
|
|
903
|
+
"heading",
|
|
904
|
+
"|",
|
|
905
|
+
"link",
|
|
906
|
+
"quote",
|
|
907
|
+
"|",
|
|
908
|
+
"preview",
|
|
909
|
+
"fullscreen",
|
|
910
|
+
"guide"
|
|
911
|
+
],
|
|
912
|
+
"spellChecker": false
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
|
|
681
919
|
__Ace Editor__ is a syntax highlighting source code editor. You can use it by setting the format to any of the following:
|
|
682
920
|
|
|
683
921
|
* actionscript
|
|
@@ -716,8 +954,10 @@ __Ace Editor__ is a syntax highlighting source code editor. You can use it by se
|
|
|
716
954
|
* pgsql
|
|
717
955
|
* php
|
|
718
956
|
* python
|
|
957
|
+
* prql
|
|
719
958
|
* r
|
|
720
959
|
* ruby
|
|
960
|
+
* rust
|
|
721
961
|
* sass
|
|
722
962
|
* scala
|
|
723
963
|
* scss
|
|
@@ -725,10 +965,12 @@ __Ace Editor__ is a syntax highlighting source code editor. You can use it by se
|
|
|
725
965
|
* sql
|
|
726
966
|
* stylus
|
|
727
967
|
* svg
|
|
968
|
+
* typescript
|
|
728
969
|
* twig
|
|
729
970
|
* vbscript
|
|
730
971
|
* xml
|
|
731
972
|
* yaml
|
|
973
|
+
* zig
|
|
732
974
|
|
|
733
975
|
```json
|
|
734
976
|
{
|
|
@@ -748,11 +990,6 @@ You can use the hyper-schema keyword `media` instead of `format` too if you pref
|
|
|
748
990
|
}
|
|
749
991
|
```
|
|
750
992
|
|
|
751
|
-
You can override the default Ace theme by setting the `JSONEditor.plugins.ace.theme` variable.
|
|
752
|
-
|
|
753
|
-
```js
|
|
754
|
-
JSONEditor.plugins.ace.theme = 'twilight';
|
|
755
|
-
```
|
|
756
993
|
|
|
757
994
|
You can enable [Ace editor options](https://github.com/ajaxorg/ace/wiki/Configuring-Ace) individually by setting the `options.ace` in schema.
|
|
758
995
|
|
|
@@ -771,6 +1008,57 @@ You can enable [Ace editor options](https://github.com/ajaxorg/ace/wiki/Configur
|
|
|
771
1008
|
}
|
|
772
1009
|
```
|
|
773
1010
|
|
|
1011
|
+
### Special editors
|
|
1012
|
+
|
|
1013
|
+
JSONEditor features specialized types of editors.
|
|
1014
|
+
|
|
1015
|
+
#### Button editor
|
|
1016
|
+
|
|
1017
|
+
Creates a button whose click callback can be defined in `JSONEditor.defaults.callbacks`. Options:
|
|
1018
|
+
|
|
1019
|
+
- `icon`: Renders an icon into the button. Must be supported by the iconLib used.
|
|
1020
|
+
- `validated`: With `true` the button is disabled until the whole editor is valid.
|
|
1021
|
+
- `action`: the name of the callback that will be invoked when the button is clicked.
|
|
1022
|
+
|
|
1023
|
+
> **Warning**
|
|
1024
|
+
> For the form to render properly all callbacks used in `action`s must also be defined in `JSONEditor.defaults.callbacks`.
|
|
1025
|
+
|
|
1026
|
+
```js
|
|
1027
|
+
JSONEditor.defaults.callbacks = {
|
|
1028
|
+
"button" : {
|
|
1029
|
+
"myAction" : function (jseditor, e) {
|
|
1030
|
+
alert('Button action')
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
```json
|
|
1037
|
+
{
|
|
1038
|
+
"format": "button",
|
|
1039
|
+
"options": {
|
|
1040
|
+
"button": {
|
|
1041
|
+
"text": "Search",
|
|
1042
|
+
"icon": "search",
|
|
1043
|
+
"action": "myAction",
|
|
1044
|
+
"validated": true
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
#### Info editor
|
|
1051
|
+
|
|
1052
|
+
Displays a label and a description text.
|
|
1053
|
+
|
|
1054
|
+
```json
|
|
1055
|
+
{
|
|
1056
|
+
"format": "info",
|
|
1057
|
+
"title": "Important:",
|
|
1058
|
+
"description": "Lorem ipsum dolor"
|
|
1059
|
+
}
|
|
1060
|
+
```
|
|
1061
|
+
|
|
774
1062
|
#### Booleans
|
|
775
1063
|
|
|
776
1064
|
The default boolean editor is a select box with options "true" and "false". To use a checkbox instead, set the format to `checkbox`.
|
|
@@ -838,10 +1126,54 @@ You can override this default by passing in a format:
|
|
|
838
1126
|
}
|
|
839
1127
|
```
|
|
840
1128
|
|
|
1129
|
+
#### Array events
|
|
1130
|
+
|
|
1131
|
+
When an array item is added, removed, moved up, moved or removed the json editor will trigger a relative event.
|
|
1132
|
+
|
|
1133
|
+
```javascript
|
|
1134
|
+
editor.on('moveRow', editor => {
|
|
1135
|
+
console.log('moveRow', editor)
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
editor.on('addRow', editor => {
|
|
1139
|
+
console.log('addRow', editor)
|
|
1140
|
+
});
|
|
1141
|
+
|
|
1142
|
+
editor.on('deleteRow', deletedValue => {
|
|
1143
|
+
console.log('deleteRow', deletedValue)
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
editor.on('deleteAllRows', deletedValues => {
|
|
1147
|
+
console.log('deleteAllRows', deletedValues)
|
|
1148
|
+
});
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
Drag and drop for array item is supported to perform a quick item moving.
|
|
1152
|
+
For array editor with format=`tabs` or `tabs-top`, you can drag the tab header directly.
|
|
1153
|
+
For the default array editor (or format=`table`), you have to drag the array item panel with Ctrl key pressed (to avoid side-effect of draggable panel), or drag any text in the input box to another item panel.
|
|
1154
|
+
|
|
1155
|
+
#### Schema loader events
|
|
1156
|
+
|
|
1157
|
+
When schemas are loaded via a request, the `schemaLoaded` event is triggered individually for each schema after its loading.
|
|
1158
|
+
Once the loading of all schemas is completed, the `allSchemasLoaded` event is triggered.
|
|
1159
|
+
|
|
1160
|
+
```javascript
|
|
1161
|
+
editor.on('schemaLoaded', (payload) => {
|
|
1162
|
+
console.log('schemasLoaded', payload.schemaUrl)
|
|
1163
|
+
console.log('schemasLoaded', payload.schema)
|
|
1164
|
+
})
|
|
1165
|
+
|
|
1166
|
+
editor.on('allSchemasLoaded', () => {
|
|
1167
|
+
console.log('allSchemasLoaded')
|
|
1168
|
+
})
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
|
|
841
1172
|
#### Objects
|
|
842
1173
|
|
|
843
1174
|
The default object layout is one child editor per row. The `grid` format will instead put multiple child editors per row.
|
|
844
|
-
This can make the editor much more compact, but at a cost of not guaranteeing child editor order.
|
|
1175
|
+
This can make the editor much more compact, but at a cost of not guaranteeing child editor order. This format will stretch
|
|
1176
|
+
columns to fill gaps untill all the 12 columns are filled.
|
|
845
1177
|
|
|
846
1178
|
```json
|
|
847
1179
|
{
|
|
@@ -852,7 +1184,50 @@ This can make the editor much more compact, but at a cost of not guaranteeing ch
|
|
|
852
1184
|
"format": "grid"
|
|
853
1185
|
}
|
|
854
1186
|
```
|
|
855
|
-
|
|
1187
|
+
|
|
1188
|
+
The `grid-strict` format instead will respect columns sizes (no stretching) and properties order.
|
|
1189
|
+
It introduces the new `grid-break` property to breaks the current row leaving a 4 colums gap.
|
|
1190
|
+
|
|
1191
|
+
```json
|
|
1192
|
+
{
|
|
1193
|
+
"type": "object",
|
|
1194
|
+
"format": "grid-strict",
|
|
1195
|
+
"properties": {
|
|
1196
|
+
"a": {
|
|
1197
|
+
"title": "a",
|
|
1198
|
+
"type": "string",
|
|
1199
|
+
"options": {
|
|
1200
|
+
"grid_columns": 4
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
"b": {
|
|
1204
|
+
"title": "b",
|
|
1205
|
+
"type": "string",
|
|
1206
|
+
"options": {
|
|
1207
|
+
"grid_columns": 4,
|
|
1208
|
+
"grid_break": true
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
"c": {
|
|
1212
|
+
"title": "c",
|
|
1213
|
+
"type": "string",
|
|
1214
|
+
"options": {
|
|
1215
|
+
"grid_columns": 6
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1218
|
+
"d": {
|
|
1219
|
+
"title": "d",
|
|
1220
|
+
"type": "string",
|
|
1221
|
+
"options": {
|
|
1222
|
+
"grid_columns": 6
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
The `categories` format groups properties in top-tabbed panels, one for each object or array property plus one that groups all added or other types of properties.
|
|
856
1231
|
Panel tabs titles came from object or array titles and for the grouping panel it defaults to "Basic", unless `basicCategoryTitle` is defined.
|
|
857
1232
|
|
|
858
1233
|
```json
|
|
@@ -875,23 +1250,29 @@ Editor Options
|
|
|
875
1250
|
|
|
876
1251
|
Editors can accept options which alter the behavior in some way.
|
|
877
1252
|
|
|
878
|
-
*
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
1253
|
+
* `switcher` - If set to false and using oneOf or anyOf, a multiple editor is not created, but validation still applies. Should be used with schemas with same type.
|
|
1254
|
+
* `titleHidden` - If set to true, the editor title will be visually hidden
|
|
1255
|
+
* `collapsed` - If set to true, the editor will start collapsed (works for objects and arrays)
|
|
1256
|
+
* `disable_array_add` - If set to true, the "add row" button will be hidden (works for arrays)
|
|
1257
|
+
* `disable_array_delete` - If set to true, all of the "delete" buttons will be hidden (works for arrays)
|
|
1258
|
+
* `disable_array_delete_all_rows` - If set to true, just the "delete all rows" button will be hidden (works for arrays)
|
|
1259
|
+
* `disable_array_delete_last_row` - If set to true, just the "delete last row" buttons will be hidden (works for arrays)
|
|
1260
|
+
* `disable_array_reorder` - If set to true, the "move up/down" buttons will be hidden (works for arrays)
|
|
1261
|
+
* `disable_collapse` - If set to true, the collapse button will be hidden (works for objects and arrays)
|
|
1262
|
+
* `disable_edit_json` - If set to true, the Edit JSON button will be hidden (works for objects)
|
|
1263
|
+
* `disable_properties` - If set to true, the Edit Properties button will be hidden (works for objects)
|
|
1264
|
+
* `array_controls_top` - If set to true, array controls (add, delete etc) will be displayed at top of list (works for arrays)
|
|
1265
|
+
* `enum` - See [Enum options](#enum-options)
|
|
1266
|
+
* `enum_titles` - An array of display values to use for select box options in the same order as defined with the `enum` keyword. Works with schema using enum values.
|
|
1267
|
+
* `expand_height` - If set to true, the input will auto expand/contract to fit the content. Works best with textareas.
|
|
1268
|
+
* `grid_columns` - Explicitly set the number of grid columns (1-12) for the editor if it's within an object using a grid layout.
|
|
1269
|
+
* `hidden` - If set to true, the editor will not appear in the UI (works for all types)
|
|
1270
|
+
* `input_height` - Explicitly set the height of the input element. Should be a valid CSS width string (e.g. "100px"). Works best with textareas.
|
|
1271
|
+
* `input_width` - Explicitly set the width of the input element. Should be a valid CSS width string (e.g. "100px"). Works for string, number, and integer data types.
|
|
1272
|
+
* `remove_empty_properties` - If set to `true` for an object, empty object properties (i.e. those with falsy values) will not be returned by getValue().
|
|
1273
|
+
* `remove_false_properties` - If set to `true` for an object, object properties with value `false` will not be returned by getValue().
|
|
1274
|
+
* `has_placeholder_option` - If set to true, a placeholder option will be added to the select editor input.
|
|
1275
|
+
* `placeholder_option_text` - Text displayed in select placeholder option.
|
|
895
1276
|
|
|
896
1277
|
```json
|
|
897
1278
|
{
|
|
@@ -912,11 +1293,145 @@ You can globally set the default options too if you want:
|
|
|
912
1293
|
```js
|
|
913
1294
|
JSONEditor.defaults.editors.object.options.collapsed = true;
|
|
914
1295
|
```
|
|
1296
|
+
InfoText
|
|
1297
|
+
------------------
|
|
1298
|
+
Using the option `infoText`, will create a info button, displaying the text you set, on hovering.
|
|
1299
|
+
|
|
1300
|
+
```json
|
|
1301
|
+
{
|
|
1302
|
+
"type": "string",
|
|
1303
|
+
"title": "Name",
|
|
1304
|
+
"options": {
|
|
1305
|
+
"infoText": "Your full name"
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
```
|
|
1309
|
+
|
|
1310
|
+
Enum options
|
|
1311
|
+
------------------
|
|
1312
|
+
|
|
1313
|
+
Using the option `enum`, it is possible to modify how enums with format `checkbox` (default) are displayed in the editor.
|
|
1314
|
+
It is an array of objects (described below), which must be in the same order as defined with the `enum` keyword.
|
|
915
1315
|
|
|
1316
|
+
Currently, the following is supported:
|
|
1317
|
+
|
|
1318
|
+
* `title`: *Optional* Display value shown instead of the enum value
|
|
1319
|
+
* `infoText`: *Optional* Creates an info button next to the title, displaying the text you set, on hovering.
|
|
1320
|
+
|
|
1321
|
+
It is possible also to set these options only for some enum values, to skip one enum value, define an empty object (`{}`).
|
|
1322
|
+
|
|
1323
|
+
```json
|
|
1324
|
+
{
|
|
1325
|
+
"type": "array",
|
|
1326
|
+
"items": {
|
|
1327
|
+
"type": "string",
|
|
1328
|
+
"enum": ["1", "2", "3", "4"],
|
|
1329
|
+
"options": {
|
|
1330
|
+
"enum": [
|
|
1331
|
+
{},
|
|
1332
|
+
{
|
|
1333
|
+
"title": "Title 2"
|
|
1334
|
+
},
|
|
1335
|
+
{ "infoText": "InfoText 3" },
|
|
1336
|
+
{
|
|
1337
|
+
"title": "Title 4",
|
|
1338
|
+
"infoText": "InfoText 4"
|
|
1339
|
+
}
|
|
1340
|
+
]
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
If both options `enum_titles[x]` and `enum[x].title` are set for the enum value `x`, than the title set under `enum[x].title` will be used.
|
|
916
1347
|
|
|
917
1348
|
Dependencies
|
|
918
1349
|
------------------
|
|
919
|
-
Sometimes, it's necessary to have one field's value depend on another's.
|
|
1350
|
+
Sometimes, it's necessary to have one field's value depend on another's.
|
|
1351
|
+
|
|
1352
|
+
The dependency information is fetched from the dependencies field in the options field of the control. The `dependencies` field should be a map where the keys are the names of the fields depended on and the value is the expected value. The value may be an array to indicate multiple value possibilities. This uses the internal field value watch system to notify fields of changes in their dependencies.
|
|
1353
|
+
|
|
1354
|
+
Here's an example schema:
|
|
1355
|
+
|
|
1356
|
+
```json
|
|
1357
|
+
{
|
|
1358
|
+
"title": "An object",
|
|
1359
|
+
"type": "object",
|
|
1360
|
+
"properties": {
|
|
1361
|
+
"fieldOne": {
|
|
1362
|
+
"title": "I should be changed to 'foo'",
|
|
1363
|
+
"type": "string",
|
|
1364
|
+
"enum": ["foo","bar"],
|
|
1365
|
+
"default": "bar"
|
|
1366
|
+
},
|
|
1367
|
+
"depender1": {
|
|
1368
|
+
"title": "I depend on fieldOne to be 'foo'",
|
|
1369
|
+
"type": "string",
|
|
1370
|
+
"enum": ["lorem","ipsum"],
|
|
1371
|
+
"options": {
|
|
1372
|
+
"dependencies": {
|
|
1373
|
+
"fieldOne": "foo"
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
},
|
|
1377
|
+
"depender2": {
|
|
1378
|
+
"title": "I depend on fieldOne to be 'bar'",
|
|
1379
|
+
"type": "string",
|
|
1380
|
+
"enum": ["dolor", "sit"],
|
|
1381
|
+
"options": {
|
|
1382
|
+
"dependencies": {
|
|
1383
|
+
"fieldOne": "bar"
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
Keys can also be an absolute path like `root.property.nested_property`
|
|
1392
|
+
|
|
1393
|
+
```json
|
|
1394
|
+
{
|
|
1395
|
+
"title": "Person",
|
|
1396
|
+
"type": "object",
|
|
1397
|
+
"required": [
|
|
1398
|
+
"gender"
|
|
1399
|
+
],
|
|
1400
|
+
"properties": {
|
|
1401
|
+
"gender": {
|
|
1402
|
+
"title": "Gender",
|
|
1403
|
+
"type": "string",
|
|
1404
|
+
"enum": [
|
|
1405
|
+
"female",
|
|
1406
|
+
"male"
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1409
|
+
"age": {
|
|
1410
|
+
"type": "object",
|
|
1411
|
+
"properties": {
|
|
1412
|
+
"maleSpecificAge": {
|
|
1413
|
+
"type": "string",
|
|
1414
|
+
"title": "Male specific age question?",
|
|
1415
|
+
"options": {
|
|
1416
|
+
"dependencies": {
|
|
1417
|
+
"root.gender": "male"
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
"femaleSpecificAge": {
|
|
1422
|
+
"type": "string",
|
|
1423
|
+
"title": "Female specific age question?",
|
|
1424
|
+
"options": {
|
|
1425
|
+
"dependencies": {
|
|
1426
|
+
"root.gender": "female"
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
```
|
|
920
1435
|
|
|
921
1436
|
The `dependencies` keyword from the JSON Schema specification is not nearly flexible enough to handle most use cases,
|
|
922
1437
|
so JSON Editor introduces a couple custom keywords that help in this regard.
|
|
@@ -990,7 +1505,7 @@ JSON Editor uses a javascript template engine to accomplish this. A barebones t
|
|
|
990
1505
|
* markup
|
|
991
1506
|
* mustache
|
|
992
1507
|
* swig
|
|
993
|
-
* underscore
|
|
1508
|
+
* underscore >=1.7 (since 1.4.0, see also [#332](https://github.com/json-editor/json-editor/pull/332))
|
|
994
1509
|
|
|
995
1510
|
You can change the default by setting `JSONEditor.defaults.options.template` to one of the supported template engines:
|
|
996
1511
|
|
|
@@ -1001,7 +1516,7 @@ JSONEditor.defaults.options.template = 'handlebars';
|
|
|
1001
1516
|
You can set the template engine on a per-instance basis as well:
|
|
1002
1517
|
|
|
1003
1518
|
```js
|
|
1004
|
-
|
|
1519
|
+
const editor = new JSONEditor(element,{
|
|
1005
1520
|
schema: schema,
|
|
1006
1521
|
template: 'hogan'
|
|
1007
1522
|
});
|
|
@@ -1031,6 +1546,40 @@ Here is the completed `full_name` example using the default barebones template e
|
|
|
1031
1546
|
}
|
|
1032
1547
|
```
|
|
1033
1548
|
|
|
1549
|
+
It is also possible to set the "template" property to a JavaScript callback function, defined under `window.JSONEditor.defaults.callbacks.template`. Inside the JavaScript callback, you have access to all the variables defined under the `watch` property + the current editor.
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
Example Schema:
|
|
1553
|
+
```js+jinja
|
|
1554
|
+
{
|
|
1555
|
+
"type": "object",
|
|
1556
|
+
"properties": {
|
|
1557
|
+
"first_name": {
|
|
1558
|
+
"type": "string"
|
|
1559
|
+
},
|
|
1560
|
+
"last_name": {
|
|
1561
|
+
"type": "string"
|
|
1562
|
+
},
|
|
1563
|
+
"full_name": {
|
|
1564
|
+
"type": "string",
|
|
1565
|
+
"template": "callbackFunction",
|
|
1566
|
+
"watch": {
|
|
1567
|
+
"fname": "first_name",
|
|
1568
|
+
"lname": "last_name"
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
```
|
|
1574
|
+
Example Callback function:
|
|
1575
|
+
```js+jinja
|
|
1576
|
+
window.JSONEditor.defaults.callbacks.template = {
|
|
1577
|
+
"callbackFunction": (jseditor,e) => {
|
|
1578
|
+
return e.fname + " " + e.lname;
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
```
|
|
1582
|
+
|
|
1034
1583
|
### Enum Values
|
|
1035
1584
|
|
|
1036
1585
|
Another common dependency is a drop down menu whose possible values depend on other fields. Here's an example:
|
|
@@ -1166,14 +1715,67 @@ also make it work with an array of objects. Here's an example:
|
|
|
1166
1715
|
|
|
1167
1716
|
All of the optional templates in the verbose form have the properties `item` and `i` passed into them. `item` refers to the array element. `i` is the zero-based index.
|
|
1168
1717
|
|
|
1718
|
+
#### JavaScript callbacks
|
|
1719
|
+
It is also possible to use JavaScript callback functions instead of templates for the enumSource properties properties: `value`, `title` and `filter`.
|
|
1720
|
+
|
|
1721
|
+
**Example Schema:**
|
|
1722
|
+
````json
|
|
1723
|
+
{
|
|
1724
|
+
"type": "object",
|
|
1725
|
+
"properties": {
|
|
1726
|
+
"possible_colors": {
|
|
1727
|
+
"type": "array",
|
|
1728
|
+
"format": "table",
|
|
1729
|
+
"items": {
|
|
1730
|
+
"type": "object",
|
|
1731
|
+
"properties": {
|
|
1732
|
+
"text": {
|
|
1733
|
+
"type": "string"
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1738
|
+
"primary_color": {
|
|
1739
|
+
"type": "string",
|
|
1740
|
+
"watch": {
|
|
1741
|
+
"colors": "possible_colors"
|
|
1742
|
+
},
|
|
1743
|
+
"enumSource": [{
|
|
1744
|
+
"source": "colors",
|
|
1745
|
+
"filter": "enumFilterCB",
|
|
1746
|
+
"title": "enumTitleCB",
|
|
1747
|
+
"value": "enumValueCB"
|
|
1748
|
+
}]
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
````
|
|
1753
|
+
|
|
1754
|
+
**Example JavaScript callbacks:**
|
|
1755
|
+
````javascript
|
|
1756
|
+
window.JSONEditor.defaults.callbacks.template = {
|
|
1757
|
+
"enumFilterCB": (jseditor, e) => {
|
|
1758
|
+
if (e.item.text.toLowerCase() == 'red') return ""; // "red" is not allowed
|
|
1759
|
+
return e.item.text;
|
|
1760
|
+
},
|
|
1761
|
+
"enumTitleCB": (jseditor, e) => e.item.text.toUpperCase(),
|
|
1762
|
+
"enumValueCB": (jseditor, e) => e.item.text.toLowerCase()
|
|
1763
|
+
};
|
|
1764
|
+
````
|
|
1765
|
+
|
|
1766
|
+
#### Sorting
|
|
1767
|
+
|
|
1768
|
+
To sort the dynamic EnumSource, you can set the EnumSource property `sort` to either `asc` or `desc`.
|
|
1769
|
+
|
|
1770
|
+
|
|
1169
1771
|
### Dynamic Headers
|
|
1170
1772
|
|
|
1171
1773
|
The `title` keyword of a schema is used to add user friendly headers to the editing UI. Sometimes though, dynamic headers, which change based on other fields, are helpful.
|
|
1172
1774
|
|
|
1173
|
-
Consider the example of an array of children. Without dynamic headers, the UI for the array elements would show `Child 1`, `Child 2`, etc..
|
|
1775
|
+
Consider the example of an array of children. Without dynamic headers, the UI for the array elements would show `Child 1`, `Child 2`, etc..
|
|
1174
1776
|
It would be much nicer if the headers could be dynamic and incorporate information about the children, such as `1 - John (age 9)`, `2 - Sarah (age 11)`.
|
|
1175
1777
|
|
|
1176
|
-
To accomplish this, use the `headerTemplate` property. All of the watched variables are passed into this template, along with the static title `title` (e.g. "Child"), the 0-based index `i0` (e.g. "0" and "1"), the 1-based index `i1`, and the field's value `self` (e.g. `{"name": "John", "age": 9}`).
|
|
1778
|
+
To accomplish this, use the `headerTemplate` property. All of the watched variables are passed into this template, along with the static title `title` (e.g. "Child"), the 0-based index `i0` (e.g. "0" and "1"), the 1-based index `i1`, extra child variable `properties.${PROPERTY_NAME}.enumTitle` and the field's value `self` (e.g. `{"name": "John", "age": 9}`).
|
|
1177
1779
|
|
|
1178
1780
|
```js+jinja
|
|
1179
1781
|
{
|
|
@@ -1182,10 +1784,18 @@ To accomplish this, use the `headerTemplate` property. All of the watched varia
|
|
|
1182
1784
|
"items": {
|
|
1183
1785
|
"type": "object",
|
|
1184
1786
|
"title": "Child",
|
|
1185
|
-
"headerTemplate": "{{ i1 }} - {{ self.name }} (age {{ self.age }})",
|
|
1787
|
+
"headerTemplate": "{{ i1 }} - {{ self.name }} (age {{ self.age }}) has a {{ properties.pet.enumTitle }}",
|
|
1186
1788
|
"properties": {
|
|
1187
1789
|
"name": { "type": "string" },
|
|
1188
|
-
"age": { "type": "integer" }
|
|
1790
|
+
"age": { "type": "integer" },
|
|
1791
|
+
"pet": {
|
|
1792
|
+
"title": "Pet",
|
|
1793
|
+
"type": "string",
|
|
1794
|
+
"enum": [ "pet_1", "pet_2" ],
|
|
1795
|
+
"options": {
|
|
1796
|
+
"enum_titles": [ "Dog", "Cat" ]
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1189
1799
|
}
|
|
1190
1800
|
}
|
|
1191
1801
|
}
|
|
@@ -1197,22 +1807,21 @@ If one of the included template engines isn't sufficient,
|
|
|
1197
1807
|
you can use any custom template engine with a `compile` method. For example:
|
|
1198
1808
|
|
|
1199
1809
|
```js
|
|
1200
|
-
|
|
1201
|
-
compile:
|
|
1810
|
+
const myengine = {
|
|
1811
|
+
compile: template =>
|
|
1202
1812
|
// Compile should return a render function
|
|
1203
|
-
|
|
1813
|
+
vars => {
|
|
1204
1814
|
// A real template engine would render the template here
|
|
1205
|
-
|
|
1815
|
+
const result = template;
|
|
1206
1816
|
return result;
|
|
1207
1817
|
}
|
|
1208
|
-
}
|
|
1209
1818
|
};
|
|
1210
1819
|
|
|
1211
1820
|
// Set globally
|
|
1212
1821
|
JSONEditor.defaults.options.template = myengine;
|
|
1213
1822
|
|
|
1214
1823
|
// Set on a per-instance basis
|
|
1215
|
-
|
|
1824
|
+
const editor = new JSONEditor(element,{
|
|
1216
1825
|
schema: schema,
|
|
1217
1826
|
template: myengine
|
|
1218
1827
|
});
|
|
@@ -1244,7 +1853,29 @@ By default, all instances of JSON Editor will use the `en` language. To overrid
|
|
|
1244
1853
|
JSONEditor.defaults.language = "es";
|
|
1245
1854
|
```
|
|
1246
1855
|
|
|
1247
|
-
|
|
1856
|
+
You can also override translations per editor in the it's schema options.
|
|
1857
|
+
|
|
1858
|
+
````json
|
|
1859
|
+
"error_const": {
|
|
1860
|
+
"type": "string",
|
|
1861
|
+
"title": "error_const",
|
|
1862
|
+
"const": "test",
|
|
1863
|
+
"default": "something else",
|
|
1864
|
+
"options": {
|
|
1865
|
+
"error_messages": {
|
|
1866
|
+
"en": {
|
|
1867
|
+
"error_const": "CUSTOM EN: Value must be the constant value"
|
|
1868
|
+
},
|
|
1869
|
+
"es": {
|
|
1870
|
+
"error_const": "CUSTOM ES: Value must be the constant value"
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
````
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
Button Customization
|
|
1248
1879
|
-----------------
|
|
1249
1880
|
|
|
1250
1881
|
All buttons have classnames in the format `json-editor-btntype-*`. Using these classnames you can choose if the button should have icon or label hidden. The icon is wrapped in an `I` tag, the label is wrapped in a `SPAN` tag.
|
|
@@ -1279,7 +1910,7 @@ Let's say you make a custom `location` editor for editing geo data. You can add
|
|
|
1279
1910
|
```js
|
|
1280
1911
|
// Add a resolver function to the beginning of the resolver list
|
|
1281
1912
|
// This will make it run before any other ones
|
|
1282
|
-
JSONEditor.defaults.resolvers.unshift(
|
|
1913
|
+
JSONEditor.defaults.resolvers.unshift(schema => {
|
|
1283
1914
|
if(schema.type === "object" && schema.format === "location") {
|
|
1284
1915
|
return "location";
|
|
1285
1916
|
}
|
|
@@ -1318,16 +1949,6 @@ The possibilities are endless. Some ideas:
|
|
|
1318
1949
|
* Better editor for arrays of strings (tag editor)
|
|
1319
1950
|
* Canvas based image editor that produces Base64 data URLs
|
|
1320
1951
|
|
|
1321
|
-
Select2 & Selectize Support
|
|
1322
|
-
----------------
|
|
1323
|
-
Select2 support is enabled by default and will become active if the Select2 library is detected.
|
|
1324
|
-
|
|
1325
|
-
Selectize support is enabled via the following snippet:
|
|
1326
|
-
```js
|
|
1327
|
-
JSONEditor.plugins.selectize.enable = true;
|
|
1328
|
-
```
|
|
1329
|
-
See the demo for an example of the `array` and `select` editor with Selectize support enabled.
|
|
1330
|
-
|
|
1331
1952
|
Custom Validation
|
|
1332
1953
|
----------------
|
|
1333
1954
|
|
|
@@ -1337,10 +1958,10 @@ Let's say you want to force all schemas with `format` set to `date` to match the
|
|
|
1337
1958
|
|
|
1338
1959
|
```js
|
|
1339
1960
|
// Custom validators must return an array of errors or an empty array if valid
|
|
1340
|
-
JSONEditor.defaults.custom_validators.push(
|
|
1341
|
-
|
|
1342
|
-
if(schema.format==="date") {
|
|
1343
|
-
if(!/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value)) {
|
|
1961
|
+
JSONEditor.defaults.custom_validators.push((schema, value, path) => {
|
|
1962
|
+
const errors = [];
|
|
1963
|
+
if (schema.format==="date") {
|
|
1964
|
+
if (!/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(value)) {
|
|
1344
1965
|
// Errors must be an object with `path`, `property`, and `message`
|
|
1345
1966
|
errors.push({
|
|
1346
1967
|
path: path,
|
|
@@ -1353,26 +1974,32 @@ JSONEditor.defaults.custom_validators.push(function(schema, value, path) {
|
|
|
1353
1974
|
});
|
|
1354
1975
|
```
|
|
1355
1976
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1977
|
+
Override Editors Methods
|
|
1978
|
+
----------------
|
|
1358
1979
|
|
|
1359
|
-
|
|
1980
|
+
```js
|
|
1981
|
+
// override class method
|
|
1982
|
+
JSONEditor.defaults.editors.integer.prototype.sanitize = function(value) {
|
|
1983
|
+
return value
|
|
1984
|
+
};
|
|
1985
|
+
```
|
|
1360
1986
|
|
|
1361
|
-
|
|
1987
|
+
or
|
|
1362
1988
|
|
|
1363
1989
|
```js
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1990
|
+
// override object method
|
|
1991
|
+
var path ="root.integerfield";
|
|
1992
|
+
editor.getEditor(path).sanitize = function(value) {
|
|
1993
|
+
return value
|
|
1994
|
+
};
|
|
1995
|
+
```
|
|
1996
|
+
|
|
1997
|
+
Support Legacy Browser (not tested)
|
|
1998
|
+
----------------------
|
|
1999
|
+
|
|
2000
|
+
JSON Editor can be used with browsers that support ES5, but in order to use it with older browsers such as IE, it is necessary to use "core-js" as a polyfill.
|
|
2001
|
+
|
|
2002
|
+
```
|
|
2003
|
+
<script src="https://unpkg.com/core-js-bundle@latest/minified.js"></script>
|
|
2004
|
+
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
|
|
1378
2005
|
```
|