* provide onValidationError callback
* linter fixes
* docu fixes
* textmode - invoke callback also when no errors
This to cover situation of changes that fixes validations
* fixed cautom validation example
* 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.
* 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
* 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
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.
The JSON path parsing code assumes that string keys within square brackets in JSON paths will be valid, parseable JSON.
However, the ajv library on which this project depends emits string keys in single quotes.
For example, ajv can emit .foo['bar'], which will ultimately end up with a call to JSON.parse("'bar'"). This causes the "Unexpected token ' in JSON at position 0" error thrown from JSON.parse.
Since ajv shouldn't need to change and since this utility is gone in the next branch, this fix checks for ajv-formatted string keys and patches them to double-quoted strings before calling JSON.parse. This is the narrowest fix for the problem.