Commit Graph

101 Commits

Author SHA1 Message Date
jos cda54f95fc Implemented `stringifyPartial` and use it in Transform modal 2019-06-26 21:57:22 +02:00
jos 1e1ee3463c Implemented `preview` mode (WIP) 2019-06-26 17:24:09 +02:00
jos 797541cd6b Make `getChildPaths` json pointer compliant 2019-06-19 12:46:50 +02:00
jos 7311e78b53 Implemented `transform` modal for modes `code` and `text` 2019-06-19 11:57:28 +02:00
jos 74b816a554 Implemented sort button in code/text mode 2019-06-19 11:16:30 +02:00
jos 10daf40b56 Use JSON schema title as name for the root object if defined (see #635) 2019-06-12 15:43:16 +02:00
Jos de Jong 3ccdeeec40
Fix #697 JSON Schema enum dropdown not working inside an array (#707)
* Fix #697 JSON Schema enum dropdown not working inside an array

* Make schema in unit test valid by adding `type: 'object'`
2019-05-29 15:51:42 +02:00
jos 70b7e7914b Fixed #663 and #682: JSONEditor not being able to handle JSON schema validation errors when the root of the document is an Array 2019-04-10 12:23:13 +02:00
jos b38816a88b Merge branch 'duplicate_key_errors_take2' into develop
# Conflicts:
#	src/js/util.js
2019-04-03 14:56:39 +02:00
jos 801921867d Improve detection of value type in transform modal 2019-03-31 19:51:12 +02:00
jos 00baaacacc Disable having duplicate nodes (except whilst typing) 2019-03-30 13:35:51 +01:00
Adam Vigneaux 09ab92017c Fix JSON path parsing for array indices (#679)
* Switch JSON path tests to strict equality

The tests for `stringifyPath` and `parsePath` were using
[`assert.deepEqual`](https://nodejs.org/api/assert.html#assert_assert_deepequal_actual_expected_message),
which was causing the tests to pass when they should not have. Beyond
that, the `deepEqual` method is deprecated. The suggested replacement is
[`assert.deepStrictEqual`](https://nodejs.org/api/assert.html#assert_assert_deepstrictequal_actual_expected_message),
which causes the tests to fail where they should.

The difference between the two methods is the different between `==` and
`===`. `deepEqual` would coerce the input `"2"` to `2`, so the test was
passing even though the output was of the wrong type (string instead of
number).

* Coerce numeric indices to numbers in parsePath

This fixes a regression introduced in
3e7e1cebfd.
2019-03-28 19:49:36 +01:00
tobiasfriden 4763bdf293 Fixed using hyphens in the path of custom validation errors (#665)
* Fixed a bug where using hyphens in the path for custom validatons error didn't work

* Added closing bracket check and unit tests

* Automatically add brackets when path component contains hyphens

* use regexp to check if dot notation is safe
2019-03-21 21:27:17 +01:00
jos 3e7e1cebfd Fixed #676: JSON Paths containing array properties with a `]` not parsed correctly 2019-03-20 17:34:39 +01:00
Adam Vigneaux c79bea4eb8 Display schema defaults inline next to Nodes (#666)
* Display schema defaults inline next to Nodes

* Improve usability of schema default display

- When value is default, make it bold and set a tooltip
- When value is not default, display the default next to the value
- When value is default and is a select, show "Default" next to it
- Lighten the color of green used for values
  This increases the contrast between normal values and default values.

* Remove styling when value is the same as the schema default

This styling may have been confusing for some users and may not have
been applicable to all situations.

* Apply is-default and is-not-default classes to values

This allows the user to supply custom styling for these states.

To set styles for values that match the default value in the schema, use
the class `.jsoneditor-is-default`.

To set styles for values that _do not_ match the default value in the
schema, use the class `.jsoneditor-is-not-default`.

* Remove extra newline after schema examples in tooltip

* Move schema default display from inline to tooltip

This presents less opportunity for user confusion and is likely to be
more widely applicable.

* Add examples of schema metadata display

* Add documentation on styling
2019-03-17 15:39:00 +01:00
Adam Vigneaux 4f4a733fd6
Fix Node._findSchema bug when path is not present in schema
Previously, the function would return the wrong schema when it was
unable to find a path in the given schema.
2019-03-15 15:29:08 -04:00
Adam Vigneaux c0915548de
Add failing Node._findSchema schema reference test 2019-03-14 16:12:03 -04:00
jos 2dfde82197 Add examples to test_schema.html 2019-03-07 20:50:05 +01:00
Adam Vigneaux 803563003c
Show examples from schema in field tooltip 2019-03-04 16:10:30 -05:00
Adam Vigneaux 03d019a554
Provide Navigator and allow locale override in test environment setup 2019-03-04 16:09:52 -05:00
Adam Vigneaux f8279537d0 Fix Node._findSchema() (#651)
* Add test setup function for simulating browser globals

* Add tests for Node._findSchema

Some of the tests currently fail, which will be helpful in fixing the
incorrect behavior of the `_findSchema` function. The current failures
are:
- the last schema in the pattern properties object is always returned
- when pattern properties are present, wrong object schemas are returned

* Add schema-based tooltip to field names

Using the `title` and `description` properties from the schema, create
and set a tooltip on each field name. When the user hovers over a field
name, it will show the applicable information: title, description, both,
or neither, depending on what data is present in the schema.

* Remove redundant setting of field name title

* Remove accidental .only() from Node tests

* Fix Node._findSchema for pattern properties

The method now checks the key against the RegExp specified by the
pattern properties instead of always returning the last pattern property
in the object.

* Fix path used for recursive calls in Node._findSchema

* Add failing Node._findSchema tests for multi-level pattern properties

* Fix Node._findSchema for schemas with properties and patternProperties
2019-02-16 14:01:30 +01:00
Adam Vigneaux dc357061a7
Add schema-based tooltip to field names
Using the `title` and `description` properties from the schema, create
and set a tooltip on each field name. When the user hovers over a field
name, it will show the applicable information: title, description, both,
or neither, depending on what data is present in the schema.
2019-02-08 09:31:28 -05:00
jos 6551701153 Fixed #610: JSON Repair now removes trailing commas 2018-12-06 20:15:14 +01:00
jos 9ac82e24d2 Publish v5.26.2 2018-11-13 20:39:02 +01:00
jos 1736b11b41 Fixed `onClose` of color picker not always being fired 2018-08-29 21:10:13 +02:00
jos 321f947e72 Fixed color picker closing immediately after the first `onChange` event, and `onChange` events are now debounced 2018-08-29 11:06:11 +02:00
jos 00f2ab0b76 Revert small test editors 2018-08-25 15:31:58 +02:00
jos fe4144f5f2 Absolutely positioned color picker 2018-08-25 15:22:37 +02:00
jos f913d4e08a Implemented `timestampTag` 2018-08-22 18:00:56 +02:00
jos b853ec3f64 Implement color picker. Expose `VanillaPicker`, `ace`, and `Ajv`. 2018-08-22 12:10:15 +02:00
jos 4f72c5e113 Display a colored square left from values containing a color 2018-08-22 09:20:19 +02:00
jos 983fafdf9c Implemented options `onChangeJSON(json)` and `onChangeText(jsonString)` 2018-08-07 11:03:27 +02:00
jos 80e5da9728 Impelemented `updateText` 2018-08-06 10:27:57 +02:00
jos 94871dd2d8 Merge branch 'develop' into update_json 2018-08-06 09:05:33 +02:00
jos 46593c24c5 Some more fixes around #558 2018-08-02 10:43:12 +02:00
jos 0ea0059696 Fixed switching from object/array to auto/string and vice versa 2018-07-29 22:00:15 +02:00
jos 69e88537c3 Implement `update` method (WIP) 2018-07-28 14:21:12 +02:00
jos 7662874036 Integrated `mobius1-selectr` 2018-07-11 10:54:08 +02:00
jos fdbfa8a951 Enclose string values in double quotes 2018-07-02 22:09:40 +02:00
jos 8b77111393 Implemented advanced sorting modal (WIP) 2018-05-30 21:54:25 +02:00
jos 9eb9c4fe0b Implemented `getSortablePaths` 2018-05-30 09:48:51 +02:00
jos 916c657e28 Set back correct `MAX_VISIBLE_CHILDS` 2018-05-16 21:17:56 +02:00
jos 904110d141 Implementing "show more" for large arrays (WIP) 2018-05-06 19:42:19 +02:00
Meir Rotstein 8cbe15aa1f move selection_api.html to examples 2018-02-13 20:08:09 +02:00
Meir Rotstein 803ce34ed4 test file for selection apis 2018-01-24 23:55:12 +02:00
Meir Rotstein f04eff7b4e unit test for getIndexForPosition() 2018-01-24 21:41:36 +02:00
jos 4875288cb7 Implemented repairing JSON objects containing special white space characters like non-breaking space 2017-11-14 21:59:23 +01:00
jos cba5659e78 Implemented repairing JSON objects containing left and right single and double quotes 2017-11-14 21:18:49 +01:00
jos 524d00e15e Fixed a bug in the sanitizer 2017-07-13 21:01:52 +02:00
Meir Rotstein b77deb969c add support for json schema references ($ref) 2017-07-05 00:28:28 +03:00