From 9a43a402083a702a025a2c595847c4b3cd8395ed Mon Sep 17 00:00:00 2001 From: Andrew Botz Date: Thu, 21 Sep 2023 11:27:25 -0500 Subject: [PATCH] Add ability to skip debounce --- src/wp-color-picker-alpha.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-color-picker-alpha.js b/src/wp-color-picker-alpha.js index 40b1d7e..2018861 100644 --- a/src/wp-color-picker-alpha.js +++ b/src/wp-color-picker-alpha.js @@ -110,6 +110,7 @@ alphaReset: false, alphaColorType: 'hex', alphaColorWithSpace: false, + alphaSkipDebounce: false, } ); this._super(); @@ -146,7 +147,11 @@ } }; - input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) ); + input.on( 'change', callback ); + + if( ! self.alphaOptions.alphaSkipDebounce ) { + input.on( 'keyup', self._debounce( callback, debounceTimeout ) ); + } // If we initialized hidden, show on first focus. The rest is up to you. if ( self.options.hide ) { @@ -408,6 +413,7 @@ alphaReset: false, alphaColorType: 'rgb', alphaColorWithSpace: false, + alphaSkipDebounce: ( !!el.data( 'alphaSkipDebounce' ) || false ), }; if ( options.alphaEnabled ) {