Skip to content

Commit

Permalink
Don't trigger updateFootnotes when spliting a paragraph block
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljullu committed May 21, 2018
1 parent 0646693 commit ac2e5af
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions core-blocks/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,23 @@ class ParagraphBlock extends Component {
} }
onSplit={ insertBlocksAfter ?
( before, after, ...blocks ) => {
const beforeFootnotes = parseFootnotesFromContent( before );

const afterFootnotes = parseFootnotesFromContent( after );
const afterBlock = createBlock( name, {
content: after,
blockFootnotes: afterFootnotes,
} );

if ( after ) {
blocks.push( afterBlock );
blocks.push( createBlock( name, {
content: after,
blockFootnotes: parseFootnotesFromContent( after ),
} ) );
}

insertBlocksAfter( blocks );

if ( before ) {
setAttributes( {
content: before,
blockFootnotes: beforeFootnotes,
blockFootnotes: parseFootnotesFromContent( before ),
} );
} else {
onReplace( [] );
}

if ( ! isEqual( blockFootnotes, beforeFootnotes ) && afterFootnotes.length ) {
updateFootnotes( beforeFootnotes, { [ afterBlock.uid ]: afterFootnotes } );
}
} :
undefined
}
Expand Down

0 comments on commit ac2e5af

Please sign in to comment.