Skip to content

Commit

Permalink
fix Footnotes not saved if the Custom Fields panel is open
Browse files Browse the repository at this point in the history
  • Loading branch information
shimotmk committed Aug 26, 2024
1 parent 0e88cda commit b0466c6
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions packages/block-library/src/footnotes/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,31 @@ export default function FootnotesEdit( { context: { postType, postId } } ) {
}
} }
onChange={ ( nextFootnote ) => {
const newValue = JSON.stringify(
footnotes.map( ( footnote ) => {
return footnote.id === id
? {
content: nextFootnote,
id,
}
: footnote;
} )
);
updateMeta( {
...meta,
footnotes: JSON.stringify(
footnotes.map( ( footnote ) => {
return footnote.id === id
? {
content: nextFootnote,
id,
}
: footnote;
} )
),
footnotes: newValue,
} );
const metaKeyInput = document.querySelector(
'input[value="footnotes"]'
);
const metaId = metaKeyInput
? metaKeyInput.id
: null;
if ( metaId ) {
document.querySelector(
`#${ metaId.replace( '-key', '-value' ) }`
).innerHTML = newValue;
}
} }
/>{ ' ' }
<a href={ `#${ id }-link` }>↩︎</a>
Expand Down

0 comments on commit b0466c6

Please sign in to comment.