From f0b061a298a5d0b726534975d4fd8abdee22f6a2 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Tue, 28 Jul 2020 17:04:57 -0600 Subject: [PATCH] Disallow unsetting colors Fixes #114 --- blocks/waves/src/edit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blocks/waves/src/edit.js b/blocks/waves/src/edit.js index 4f27005e..823da0c3 100644 --- a/blocks/waves/src/edit.js +++ b/blocks/waves/src/edit.js @@ -243,7 +243,7 @@ function Edit( { attributes, className, isSelected, setAttributes } ) { { label: __( 'Color 1', 'waves' ), value: colors.color1, - onChange: ( color1 ) => { + onChange: ( color1 = colors.color1 ) => { const previewImage = updatePreview( { color1: parseColor( color1 ), } ); @@ -253,7 +253,7 @@ function Edit( { attributes, className, isSelected, setAttributes } ) { { label: __( 'Color 2', 'waves' ), value: colors.color2, - onChange: ( color2 ) => { + onChange: ( color2 = colors.color2 ) => { const previewImage = updatePreview( { color2: parseColor( color2 ), } ); @@ -263,7 +263,7 @@ function Edit( { attributes, className, isSelected, setAttributes } ) { { label: __( 'Color 3', 'waves' ), value: colors.color3, - onChange: ( color3 ) => { + onChange: ( color3 = colors.color3 ) => { const previewImage = updatePreview( { color3: parseColor( color3 ), } ); @@ -273,7 +273,7 @@ function Edit( { attributes, className, isSelected, setAttributes } ) { { label: __( 'Color 4', 'waves' ), value: colors.color4, - onChange: ( color4 ) => { + onChange: ( color4 = colors.color4 ) => { const previewImage = updatePreview( { color4: parseColor( color4 ), } );