Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid mutating the attributes of the current block
  • Loading branch information
Jackie6 committed Mar 28, 2019
commit ff40169a1f3005253f1a97fd83f0653eb71c46c2
6 changes: 4 additions & 2 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ class ParagraphBlock extends Component {
// any other blocks being inserted after the current paragraph
if ( after.length ) {
// If after has content, keep the new block styling same as current one.
const newBlockAttributes = attributes;
newBlockAttributes.content = after;
const newBlockAttributes = {
...attributes,
content: after
};
blocks.push( createBlock( name, newBlockAttributes ) );
} else {
// Otherwise, add a default block
Expand Down