From 1736b11b41c791ad58623ab8247e2671ab387a02 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 29 Aug 2018 21:10:13 +0200 Subject: [PATCH] Fixed `onClose` of color picker not always being fired --- HISTORY.md | 6 ++++++ src/js/createAbsoluteAnchor.js | 2 -- test/test_color_picker.html | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index f9b7de2..1b97fe4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ https://github.com/josdejong/jsoneditor +## not yet released, version 5.24.4 + +- Fixed `onClose` of color picker not being fired when clicking outside + the picker to close it. + + ## 2018-08-29, version 5.24.3 - Fixed color picker not working in ES6 projects. diff --git a/src/js/createAbsoluteAnchor.js b/src/js/createAbsoluteAnchor.js index 3a0ae83..32bf7cf 100644 --- a/src/js/createAbsoluteAnchor.js +++ b/src/js/createAbsoluteAnchor.js @@ -53,8 +53,6 @@ exports.createAbsoluteAnchor = function (anchor, parent, onDestroy) { var target = event.target; if ((target !== absoluteAnchor) && !util.isChildOf(target, absoluteAnchor)) { destroy(); - event.stopPropagation(); - event.preventDefault(); } } diff --git a/test/test_color_picker.html b/test/test_color_picker.html index e279b80..ad7c3f8 100644 --- a/test/test_color_picker.html +++ b/test/test_color_picker.html @@ -50,11 +50,18 @@ color: color, popup: 'bottom', onChange: function (color) { + console.log('onChange', color) var alpha = color.rgba[3] var hex = (alpha === 1) ? color.hex.substr(0, 7) // return #RRGGBB : color.hex // return #RRGGBBAA onChange(hex) + }, + onDone: function (color) { + console.log('onDone', color) + }, + onClose: function (color) { + console.log('onClose', color) } }).show(); }