Fixed `onClose` of color picker not always being fired

This commit is contained in:
jos 2018-08-29 21:10:13 +02:00
parent 1f1a92354d
commit 1736b11b41
3 changed files with 13 additions and 2 deletions

View File

@ -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.

View File

@ -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();
}
}

View File

@ -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();
}