diff --git a/src/Admin/AdminSettingsPage.php b/src/Admin/AdminSettingsPage.php index 5eec1e8..2f5d507 100644 --- a/src/Admin/AdminSettingsPage.php +++ b/src/Admin/AdminSettingsPage.php @@ -92,7 +92,7 @@ protected function adminEnqueueScripts(): void Script::HANDLE => 'wp-color-picker-alpha', Script::SRC => $get_src('src/assets/js/wp-color-picker-alpha.js'), Script::DEPENDENCIES => ['jquery', 'wp-color-picker'], - Script::VERSION => '3.0.2', + Script::VERSION => '3.0.3', Script::IN_FOOTER => true, ]), new Script([ diff --git a/src/assets/js/wp-color-picker-alpha.js b/src/assets/js/wp-color-picker-alpha.js index 1114ea2..a6f5261 100644 --- a/src/assets/js/wp-color-picker-alpha.js +++ b/src/assets/js/wp-color-picker-alpha.js @@ -4,7 +4,7 @@ * Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker * Only run in input and is defined data alpha in true * - * Version: 3.0.2 + * Version: 3.0.3 * https://github.com/kallookoo/wp-color-picker-alpha * Licensed under the GPLv2 license or later. */ @@ -110,6 +110,8 @@ alphaReset: false, alphaColorType: 'hex', alphaColorWithSpace: false, + alphaSkipDebounce: false, + alphaDebounceTimeout: 100, } ); this._super(); @@ -124,7 +126,6 @@ */ _addInputListeners: function( input ) { var self = this, - debounceTimeout = 100, callback = function( event ){ var val = input.val(), color = new Color( val ), @@ -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, self.alphaOptions.alphaDebounceTimeout ) ); + } // 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 ) {