Closed CodeExplore closed 3 years ago
Version (see Pickr.version): any Used bundle (es5 or normal one): any Used theme (default is classic): any Browser-version: any Operating-system: any
The problem is: There is no way to clear picker input if we set clear: false, the users never can't clear the input. This lines force us to update it.
https://github.com/Simonwep/pickr/blob/c1ebb361a2f31d19e3fc88355bf4f961b4fb591d/src/js/pickr.js#L415-L416
Also do you know, Popular WordPress Elementor Plugin removes this line in source code as well. because there is no option for disable update.
What we need: If users clear input field by manually, don't force to update input.
Solution: We can add a option (allowEmpty) like this:
// configuration allowEmpty: true,
// Line 415 from: this._recalc = e.type === 'blur'; // to this._recalc = ( !options.allowEmpty || e.target.value ) && e.type === 'blur';
Test: https://jsfiddle.net/odhr1vzn/3/ Edit: https://github.com/CodeExplore/pickr/commit/fb0f8ed587f1e1c78866b6013d0ca3541c35a6c7
Regards
Here you go. There is a bug though, fixed in ae4145029c1f1fd01df91d767b3bb87f798688a3, I'll release a patch version later this week.
Thanks for time @Simonwep
Your environment:
The problem is: There is no way to clear picker input if we set clear: false, the users never can't clear the input. This lines force us to update it.
https://github.com/Simonwep/pickr/blob/c1ebb361a2f31d19e3fc88355bf4f961b4fb591d/src/js/pickr.js#L415-L416
Also do you know, Popular WordPress Elementor Plugin removes this line in source code as well. because there is no option for disable update.
What we need: If users clear input field by manually, don't force to update input.
Solution: We can add a option (allowEmpty) like this:
Test: https://jsfiddle.net/odhr1vzn/3/ Edit: https://github.com/CodeExplore/pickr/commit/fb0f8ed587f1e1c78866b6013d0ca3541c35a6c7
Regards