Skip to content

Commit

Permalink
Update wp-color-picker-alpha to v3.0.3. (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
thefrosty authored Apr 24, 2024
1 parent 3f80444 commit 515b1f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Admin/AdminSettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
12 changes: 9 additions & 3 deletions src/assets/js/wp-color-picker-alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -110,6 +110,8 @@
alphaReset: false,
alphaColorType: 'hex',
alphaColorWithSpace: false,
alphaSkipDebounce: false,
alphaDebounceTimeout: 100,
} );

this._super();
Expand All @@ -124,7 +126,6 @@
*/
_addInputListeners: function( input ) {
var self = this,
debounceTimeout = 100,
callback = function( event ){
var val = input.val(),
color = new Color( val ),
Expand All @@ -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 ) {
Expand Down Expand Up @@ -408,6 +413,7 @@
alphaReset: false,
alphaColorType: 'rgb',
alphaColorWithSpace: false,
alphaSkipDebounce: ( !!el.data( 'alphaSkipDebounce' ) || false ),
};

if ( options.alphaEnabled ) {
Expand Down

0 comments on commit 515b1f8

Please sign in to comment.