Skip to content

Commit

Permalink
When converting reusable -> regular, replace the block with a copy
Browse files Browse the repository at this point in the history
Making a copy of the referenced block prevents the regular block from
being removed should the reuasble block be later deleted.
  • Loading branch information
noisysocks committed Mar 13, 2018
1 parent 3778bdf commit ba90cbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/store/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ export default {
const state = store.getState();
const oldBlock = getBlock( state, action.uid );
const reusableBlock = getReusableBlock( state, oldBlock.attributes.ref );
const newBlock = getBlock( state, reusableBlock.uid );
const referencedBlock = getBlock( state, reusableBlock.uid );
const newBlock = createBlock( referencedBlock.name, referencedBlock.attributes );
store.dispatch( replaceBlock( oldBlock.uid, newBlock ) );
},
CONVERT_BLOCK_TO_REUSABLE( action, store ) {
Expand Down

0 comments on commit ba90cbc

Please sign in to comment.