Commit Graph

506 Commits

Author SHA1 Message Date
jos 8cc4bf7efa Fix error in transform modal in case of an empty object 2019-04-02 21:27:50 +02:00
jos b279ed3069 Fix CSS class for default/non-default schema values not applied to enums, see (#666) 2019-04-02 21:09:17 +02:00
jos ff8be9635a Remove redundant 300px bottom padding (see #416) 2019-04-02 20:49:53 +02:00
jos ebe7bafe51 Fix JMESPath query not working anymore for arrays with numbers 2019-03-31 20:03:56 +02:00
jos 801921867d Improve detection of value type in transform modal 2019-03-31 19:51:12 +02:00
jos 4818c4bb27 Styling improvements in the transform modal 2019-03-31 17:17:47 +02:00
jos 9e3b6fb196 Fixed #416: Clipped action menu for append nodes 2019-03-30 21:00:26 +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
jos 7c398aeef7 Update history. Fix JSON schema default value styling not working for `false` and `null`, and fixed the styling not updating when clicking a boolean checkbox (See #666) 2019-03-17 15:56:29 +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
jos 1d0870af36 Merge branch 'fix/schema-ref-examples' of https://github.com/AdamVig/jsoneditor into AdamVig-fix/schema-ref-examples 2019-03-17 15:31:23 +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
jos a01ff4a892 Fix missing polyfill on IE11 2019-03-14 21:21:19 +01:00
Adam Vigneaux f36cecdfde
Fix Node._findSchema schema reference support 2019-03-14 16:14:14 -04:00
DappWind 92fbe410a3 fix(i18b): fix Chinese translation error (#670) 2019-03-14 20:42:07 +01:00
adf0001 390afbdae0 Fix Chinese translation error (#668) 2019-03-11 19:52:46 +01:00
Adam Vigneaux c8aeb1134d
Merge remote-tracking branch 'upstream/develop' into tooltip-examples 2019-03-04 16:15:14 -05:00
Adam Vigneaux 803563003c
Show examples from schema in field tooltip 2019-03-04 16:10:30 -05:00
jos 1857e80fcb Merge branch 'master' of https://github.com/RobAley/jsoneditor into RobAley-master 2019-03-02 10:18:49 +01:00
RobAley 74272397b4
change oncreatemenu path to object 2019-02-25 16:03:25 +00:00
RobAley b48f084cf5
Change oncreatemenu path to object 2019-02-25 16:02:35 +00:00
RobAley 43ac83520d
changed onCreateMenu path to object 2019-02-25 16:00:40 +00:00
RobAley aec7308c78
Add call to onCreateMenu 2019-02-21 14:31:14 +00:00
RobAley aa577d2437
Add call to onCreateMenu 2019-02-21 14:26:37 +00:00
RobAley 981ce535d1
Change onCreateMenu to pass path rather than node 2019-02-21 14:23:40 +00:00
jos 704a50d415 Fixed #661: JSONEditor broken on IE11 caused by duplicate JSON entries in a translation 2019-02-20 20:38:21 +01:00
RobAley 5d833d2131
Add call to options.onCreateMenu
to allow customisation of context menu items
2019-02-17 11:16:14 +00:00
RobAley 2bd4ca67af
Add onCreateMenu as valid option 2019-02-17 11:12:07 +00: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
jos 53a4f57dda Fix #657: `onClassName` throwing an error when a node is removed 2019-02-14 20:42:23 +01:00
jos 7c17ef9001 Merge branch 'add-schema-description-tooltips' of https://github.com/AdamVig/jsoneditor into AdamVig-add-schema-description-tooltips 2019-02-13 11:50:40 +01:00
Adam Vigneaux 9377ee825d
Remove redundant setting of field name title 2019-02-11 11:24:05 -05:00
jos dc55c11015 Fix merge conflicts 2019-02-09 12:57:09 +01:00
Berat Postalcioglu ae2e8018c5 tr json is updated 2019-02-09 02:52:47 +03:00
Berat Postalcioglu 07f7e0fcb4 turkish language support is added by adding tr json to i18n.js 2019-02-09 02:19:27 +03: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
long2ice 10bcf425f7 i18n support zh_CN (#640)
* i18n support chinese

* fix _locales

* rename zh_CN to zh-CN
change the indentation to 2 space
2019-02-05 20:48:56 +01:00
jos cb2f343d1d Fix #639: Occurrence of non-ES5 `const` declaration in published code 2019-01-23 14:27:19 +01:00
jos 3f9ea75f20 Minor code cleanup 2019-01-22 20:44:52 +01:00
jos 7d9db67d69 Fix #637: vertical white border left/right from the main menu in some specific circumstances 2019-01-22 20:44:10 +01:00
jos 958463a9cd Fix #638: cannot expand after collapse 2019-01-22 20:27:23 +01:00
Pawel Raszewski 1c5d7d71ac added an ability to set custom css classes for Node's field and value (#604)
* update for gulp 4.0.0

* added an ability to set custom css classes for Node's field and value

* v5.9.8-beta

* wip

* wip

* wip

* wip

* wip

* wip

* cleanup

* reverted ./dist/ files

* cleanup

* reverted package-lock.json

* updated onClassName signature

* recursive node class name update on change

* add/remove css classes on node

* example fix

* merged remote

* removed yarn.lock

* changes get reflected on both sides of the diff view in example 20

* refactored and cleaned up example 20
2019-01-21 20:42:43 +01:00
Ben Chadwick a20908f462 Configurable max visible childs (#630)
* repair branch; undo childs->children change; make getMaxVisibleChilds a fn

* address PR comment
2019-01-16 17:47:08 +01:00
jos 4e62cf5ba5 Publish v5.27.1 2019-01-16 15:59:11 +01:00
Tyler Chen 4f9fc926f8 Update Node.js (#624)
* Update Node.js

add both:
1. fix childSchema with $ref, and not display the select element on the child schema because of not found enum
2. add title from schema description to show the tips for user input

* Update Node.js

fix this.editor.options.schema could be nullable.

* Update Node.js

improve the Node._findSchema to Node._findSchema = function (schema, schemaRefs, path) { ... } by tylerchen

* update Node._findSchema to Node._findSchema = function (schema, schemaRefs, path)
2019-01-16 14:18:02 +01:00
Meir Rotstein 02d7d0fc71 Add option for show all path on the navigation bar (tree mode) (#628)
* navigation bar - allow to see all path when there is no space

* fix: ellipsis was not presented on some cases

* some code cleaning
2019-01-12 11:25:02 +01:00
jos e9f6a299f7 Publish v5.27.0 2019-01-05 15:21:54 +01:00
jos 8c74bc7ef9 Put try/catch directly around `this.editor.options.onNodeName(...)` (see #617) 2019-01-05 15:00:13 +01:00