Skip to content

Commit

Permalink
Reset classes when required otherwise multiple behavors are attached
Browse files Browse the repository at this point in the history
Previously add was not reseting to the original state of each block.
  • Loading branch information
mitogh committed Feb 13, 2017
1 parent 043d62d commit d45dfee
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit d45dfee

Please sign in to comment.