Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footnotes: fix anchor order replacing #58791

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/core-data/src/footnotes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function updateFootnotesFromMeta( blocks, meta ) {
const richTextValue =
typeof value === 'string'
? RichTextData.fromHTMLString( value )
: value;
: new RichTextData( value );

richTextValue.replacements.forEach( ( replacement ) => {
if ( replacement.type === 'core/footnote' ) {
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/specs/editor/various/footnotes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ test.describe( 'Footnotes', () => {
},
] );

// Check if the numbers in the editor content updated.
await expect( editor.canvas.locator( '.fn' ) ).toHaveText( '1' );

await editor.canvas.locator( 'p:text("first paragraph")' ).click();

await editor.showBlockToolbar();
Expand Down
Loading