Skip to content

Commit

Permalink
Fixed color picker not working in ES6 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Aug 29, 2018
1 parent d528c37 commit ed9a6d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
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

- Improved error and validation messaging in `text` mode.
Expand Down
11 changes: 7 additions & 4 deletions src/js/vanilla-picker/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
var VanillaPicker
var VanillaPicker;

if (window.Picker) {
// use the already loaded instance of VanillaPicker
VanillaPicker = window.Picker
VanillaPicker = window.Picker;
}
else {
try {
// load brace
VanillaPicker = require('vanilla-picker');
// load color 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) {
// probably running the minimalist bundle
Expand Down

0 comments on commit ed9a6d4

Please sign in to comment.