From ed9a6d48f3ab89a6238f2949ce14e38b72eed666 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 29 Aug 2018 10:53:33 +0200 Subject: [PATCH] Fixed color picker not working in ES6 projects --- HISTORY.md | 5 +++++ src/js/vanilla-picker/index.js | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 705574b2c..c6c31b1c3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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. diff --git a/src/js/vanilla-picker/index.js b/src/js/vanilla-picker/index.js index 012a30ff2..b0daecc56 100644 --- a/src/js/vanilla-picker/index.js +++ b/src/js/vanilla-picker/index.js @@ -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