From be412544eefaa94f2834339a47772cc79325835d Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 16 Aug 2020 22:16:14 +0100 Subject: [PATCH] add toolbaritem button --- src/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index d4d0362..2526010 100644 --- a/src/index.js +++ b/src/index.js @@ -45,6 +45,10 @@ registerBlockType(`${NAMESPACE}/${SLUG}`, { type: 'string', default: 'rgba(0, 0, 0, 1)', }, + toggle: { + type: 'boolean', + default: false, + }, }, edit({ attributes, setAttributes, className }) { @@ -70,11 +74,11 @@ registerBlockType(`${NAMESPACE}/${SLUG}`, { - console.log('Toolbar Button go brrrr!') - } + onClick={() => { + setAttributes({ toggle: !attributes.toggle }); + }} > - Toolbar Button + Toggle {attributes.toggle ? 'On' : 'Off'}