Fixed color picker not working in ES6 projects

This commit is contained in:
jos 2018-08-29 10:53:33 +02:00
parent d528c37909
commit ed9a6d48f3
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,11 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## 2018-08-29, version 5.24.3
- Fixed color picker not working in ES6 projects.
## 2018-08-27, version 5.24.2 ## 2018-08-27, version 5.24.2
- Improved error and validation messaging in `text` mode. - Improved error and validation messaging in `text` mode.

View File

@ -1,13 +1,16 @@
var VanillaPicker var VanillaPicker;
if (window.Picker) { if (window.Picker) {
// use the already loaded instance of VanillaPicker // use the already loaded instance of VanillaPicker
VanillaPicker = window.Picker VanillaPicker = window.Picker;
} }
else { else {
try { try {
// load brace // load color picker
VanillaPicker = require('vanilla-picker'); // Note that we load the ES5 distribution bundle
// instead of the "default" as the default currently
// points to `src/picker.js` which is ES6 code (v2.3.0).
VanillaPicker = require('vanilla-picker/dist/vanilla-picker');
} }
catch (err) { catch (err) {
// probably running the minimalist bundle // probably running the minimalist bundle