* 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
* 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
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.