code-block-pro icon indicating copy to clipboard operation
code-block-pro copied to clipboard

Adding footnotes mangles all Code Block Pro blocks

Open wadetregaskis opened this issue 1 year ago • 7 comments

Whenever a footnote is added, all Code Block Pro blocks on the page mangle their contents, replacing actual line returns with the literal text <br>.

This has been happening for a while (months or more), but I feel like it didn't always happen.

WordPress 6.5.5 with Code Block Pro 1.26.4 currently.

wadetregaskis avatar Jul 15 '24 23:07 wadetregaskis

Are you adding something within the code block or outside in another block?

A <br> should not render as a new line within the code block.

Am I understanding it correctly? Do you have a URL or a screenshot?

KevinBatdorf avatar Jul 16 '24 00:07 KevinBatdorf

That's correct.

The footnote is added outside the code block. e.g.:


Before

If I now place the cursor after the word "etc" and insert a footnote, it immediately becomes:


After

Worse, this cannot be undone (the undo arrow in the WordPress toolbar is enabled but does nothing when clicked, and likewise ⌘Z does nothing).

wadetregaskis avatar Jul 16 '24 20:07 wadetregaskis

Is the footnote block a plugin? Maybe I can debug what's going on if I reproduce it.

KevinBatdorf avatar Jul 16 '24 22:07 KevinBatdorf

It's built into WordPress (since version 6.3).

wadetregaskis avatar Jul 16 '24 23:07 wadetregaskis

Okay I thought so but couldn't find it. I'll look into it and follow up when i figure out what's going on.

KevinBatdorf avatar Jul 17 '24 14:07 KevinBatdorf

Looks like this broke in 6.5 specifically. I'll need to debug some more to see if there's something I can do to intercept their code. It seems like they are re-injecting the block but mangling the formatting. Further, like you mention, it doesn't add to the edit history. Might need to patch the footnotes block, which could take time.

For now, maybe you can add the footnotes before the blocks? I know that's not very convenient but I can't think of any other temporary workaround.

KevinBatdorf avatar Jul 20 '24 07:07 KevinBatdorf

Yeah, that's essentially what I've been trying to do.

Thanks for looking into it. Is it a WordPress bug? It sounds like it shouldn't be mucking with your plug-in's block.

wadetregaskis avatar Jul 20 '24 14:07 wadetregaskis