Commit Graph

139 Commits

Author SHA1 Message Date
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
Stephen Thompson 48408f4ded Fix https://github.com/josdejong/jsoneditor/issues/314
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.
2016-09-22 18:06:22 -04:00
jos 309e8f9bc2 Updated history and bootstrap test file 2016-04-11 21:42:38 +02:00
jos ea473c54aa Fixed #289: Some CSS breaking when using the editor in combination with materialize.css or bootstrap 2016-04-09 20:55:07 +02:00
jos 8f7b656c3c Extended `util.parsePath` with support for all '*' 2016-04-04 21:28:23 +02:00
jos bfad6f5e7b Added some test pages 2016-03-20 15:56:28 +01:00
jos ec2511793a Fixed #259: when having a JSONEditor inside an HTML form, clicking an entry in the context menu did submit the form 2016-01-19 21:52:52 +01:00
jos 8ec471b6dc Improvements in sanitizing invalid JSON 2016-01-16 14:49:04 +01:00
jos b26eb2ebe4 Fixed an issue with a horiziontal scrollbar popping with a popover on displayed on the right side 2016-01-14 20:04:45 +01:00
jos e473209f1d Debouncing keyboard input implemented for fields too 2016-01-12 20:18:56 +01:00
jos f45fefe38f Implemented debouncing of keyboard input, resulting in much less history actions whilst typing 2016-01-12 18:11:56 +01:00
jos c0077250ef Fixed #222: editor throwing `onChange` events when switching mode 2016-01-12 17:25:33 +01:00
jos be40705cde Neatly resize the ace editor when validation errors are added/removed 2016-01-12 15:41:22 +01:00
jos 0690202f3a Implemented #183: display a checkbox left from boolean values, so you can easily switch between true/false. 2016-01-12 15:18:11 +01:00
jos 1d9d9c2594 Implemented method `setSchema` 2016-01-12 13:16:13 +01:00
jos a2b84b2dd8 Updated readme, docs, added example 2016-01-12 12:40:23 +01:00
jos 30eea90614 Added build script for minimalist version 2016-01-12 11:38:38 +01:00
jos 4b5ac7434f Parent nodes now display an error when a child node is invalid 2016-01-11 17:06:12 +01:00
jos e21aad3e69 Basic JSON schema validation working 2016-01-11 15:44:03 +01:00
jos 5f99f09c0f Fixed dragging multiple nodes horizontally 2015-12-30 17:26:39 +01:00
jos db0345c668 Styling of values in tree mode now customizable. Added a custom styling example 2015-12-27 17:36:59 +01:00
jos de314b897e Renamed options `change`, `editable`, `error` to respectively `onChange`, `onEditable`, and `onError`. Implemented `onModeChange` and `getMode`. 2015-12-25 11:38:41 +01:00
jos cafd4daba3 Implemented a new option `escapeUnicode`, which will show the hexadecimal unicode instead of the character itself. (See #93 and #230). 2015-12-24 20:20:50 +01:00
jos 0b234f6375 Some more fixes related to unicode and escape chars 2015-12-24 17:22:01 +01:00
jos 9cdff41afa Fixed #230: unicode characters are not escaped 2015-12-22 15:31:24 +01:00
jos dc40abf143 Fixed #230, Fixed #227, and Fixed #93: html and unicode characters not escaped 2015-12-21 14:39:15 +01:00
jos d9939177dd Moved images also to /dist 2015-02-28 21:02:39 +01:00
jos 75372fa3d7 More unit tests and a refinement of the regexp to remove JSONP encapsulation 2015-02-28 17:03:40 +01:00
jos b94b87c66b Fixed bugs in the JSON sanitizer, no longer manipulating comments or JSON-like structures inside strings. 2015-02-28 16:54:34 +01:00
jos 86e15f74e2 Added some unit tests 2015-02-28 15:04:46 +01:00
jos 0db2c35c2b Using brace to load Ace. Ace and jsonlint are now packed by default with JSONEditor. Removed all redundant build stuff for the assets. 2015-02-27 21:54:04 +01:00
jos b947e868eb Improved the `editable` callback: now also provides the path to a node and the nodes value 2014-07-27 21:08:59 +02:00
jos 1133024ae7 Implemented setting editable/readonly nodes individually via config function `editable` 2014-07-27 15:46:42 +02:00
jos 5f9d4a54a2 Added css concat and minify to gulpfile 2014-05-29 22:35:47 +02:00
jos d6da7f548e Refactored JSONEditor sourcecode to AMD modules 2014-05-29 22:13:37 +02:00
jos 6eea2b6335 Renamed files to match the contained prototype 2014-05-29 18:51:17 +02:00
jos 282dc4f7ac Moved sourcecode from `/jsoneditor` to `/src` 2014-05-29 18:42:14 +02:00
jos 4eae0cff1f Loading assets Ace Editor and JSONLint via npm. Auto build assets. 2014-05-29 18:35:39 +02:00
jos 85100e9fb4 Removed web application from the project 2014-05-29 14:22:50 +02:00
josdejong e302507c7a Fixed #80 and #70 (again) 2013-12-07 15:30:11 +01:00
josdejong 8ddc6f3946 Disabled saving files using HTML5 on Firefox to prevent a Firefox bug 2013-11-15 16:03:52 +01:00
josdejong 430a2ce5a4 Improved splitter: can now completely hide the panels. Added highlighting of the splitter. 2013-03-07 22:35:06 +01:00
josdejong df367e62a7 Reorganized the namespacing, moved to jsoneditor.*. More consistent, and will make it easier to pack the library as a module. 2013-01-05 14:32:40 +01:00
josdejong 22c8037036 Added test file 2013-01-01 21:04:16 +01:00
josdejong 2a64d5315e Splitted jsoneditor.js and jsoneditor.css into multiple source files. Rearranged the folders a little, and updated the build script. 2013-01-01 20:54:07 +01:00
Jos de Jong 18d56db063 - Implemented load/save functionality.
- Rearranged the code.
- Updated the build file accordingly
2012-10-31 22:16:07 +01:00
Jos de Jong e290ff15da Restructured the files 2012-08-16 21:18:37 +02:00
Jos de Jong 321a5e91a0 Cleaned up old files 2012-08-16 21:04:36 +02:00
Jos de Jong eeda3673cd Moved the search functionality to a separate prototype SearchBox 2012-07-29 21:42:26 +02:00
Jos de Jong bd45e9bf60 Added a test file to test methods for extracting innerText including return characters from an editable div (see Issue #5) 2012-07-24 22:36:25 +02:00
= 3ed3e0e48e test file added for testing breaking a long url 2012-05-30 10:03:22 +02:00
= 28ba72f576 first commit 2012-04-21 13:28:28 +02:00