diff --git a/HISTORY.md b/HISTORY.md index c6c31b1..f9b7de2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,8 @@ https://github.com/josdejong/jsoneditor ## 2018-08-29, version 5.24.3 - Fixed color picker not working in ES6 projects. +- Fixed color picker closing immediately after the first `onChange` + event, and `onChange` events are now debounced like all text inputs. ## 2018-08-27, version 5.24.2 diff --git a/src/js/Node.js b/src/js/Node.js index 035d9d4..4d45ad6 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -3362,15 +3362,13 @@ Node.prototype._showColorPicker = function () { var colorAnchor = createAbsoluteAnchor(this.dom.color, this.editor.frame); this.editor.options.onColorPicker(colorAnchor, this.value, function onChange(value) { - colorAnchor.destroy(); - if (typeof value === 'string' && value !== node.value) { // force recreating the color block, to cleanup any attached color picker node._deleteDomColor(); node.value = value; node.updateDom(); - node._onChangeValue(); + node._debouncedOnChangeValue(); } }); } diff --git a/test/test_color_picker.html b/test/test_color_picker.html new file mode 100644 index 0000000..e279b80 --- /dev/null +++ b/test/test_color_picker.html @@ -0,0 +1,85 @@ + + +
+ + + + + + + + + ++ Test color picker firing onChange on every change instead of onDone. +
+ + + + + +