From f7c0136c7604d7e5d140ab21893d9d994e7c864e Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Tue, 28 Jul 2020 17:11:02 -0600 Subject: [PATCH] Fix dataset source outside of the editor --- blocks/waves/waves.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/blocks/waves/waves.js b/blocks/waves/waves.js index fa9e26b8..747cefc6 100644 --- a/blocks/waves/waves.js +++ b/blocks/waves/waves.js @@ -17,13 +17,20 @@ .querySelectorAll( '.wp-block-a8c-waves canvas' ) .forEach( ( canvas ) => { const dataset = { - color1: parseColor( dataset.color1 ), - color2: parseColor( dataset.color2 ), - color3: parseColor( dataset.color3 ), - color4: parseColor( dataset.color4 ), - complexity: Number.parseInt( dataset.complexity, 10 ), - mouseSpeed: Number.parseFloat( dataset.mouseSpeed ), - fluidSpeed: Number.parseFloat( dataset.fluidSpeed ), + color1: parseColor( canvas.dataset.color1 ), + color2: parseColor( canvas.dataset.color2 ), + color3: parseColor( canvas.dataset.color3 ), + color4: parseColor( canvas.dataset.color4 ), + complexity: Number.parseInt( + canvas.dataset.complexity, + 10 + ), + mouseSpeed: Number.parseFloat( + canvas.dataset.mouseSpeed + ), + fluidSpeed: Number.parseFloat( + canvas.dataset.fluidSpeed + ), }; run( canvas, dataset ); } );