From d45dfee3c2c833ffa9a1a5094ca06586aed2e8f7 Mon Sep 17 00:00:00 2001 From: mitogh Date: Mon, 13 Feb 2017 08:42:25 -0600 Subject: [PATCH] Reset classes when required otherwise multiple behavors are attached Previously add was not reseting to the original state of each block. --- blocks.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/blocks.js b/blocks.js index dbbb162fe2dc9a..9d2cf17399ae78 100644 --- a/blocks.js +++ b/blocks.js @@ -121,10 +121,10 @@ function showControls( node ) { switcher.style.top = ( position.top + 18 + window.scrollY ) + 'px'; // show/hide block-specific block controls + blockControls.className = 'block-controls'; getTypeKinds( blockType ).forEach( function( kind ) { - blockControls.classList.add( 'is-' + kind ); + blockControls.classList.add( 'is-' + kind ); } ); - blockControls.classList.add( 'block-controls' ); blockControls.style.display = 'block'; // reposition block-specific block controls @@ -311,8 +311,10 @@ function showSwitcherMenu( event ) { function setImageState( className, event ) { event.stopPropagation(); - selectedBlock.classList.add( 'is-selected' ); - selectedBlock.classList.add( className ); + selectedBlock.className = 'is-selected'; + if ( className ) { + selectedBlock.classList.add( className ); + } } function l( data ) {