ev0-astro-theme icon indicating copy to clipboard operation
ev0-astro-theme copied to clipboard

Code blocks error

Open lazybobcat opened this issue 11 months ago • 1 comments

Hello, I have an issue on the code blocks and so does the theme preview at this URL: https://ev0.gndx.dev/blog/markdown-style-guide/

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')

The error comes from the Code.astro file, the variable button and check are null:

  codeBlock.forEach((code) => {
    const button = code.querySelector(".copy-button");
    const check = code.querySelector(".check-span");

It looks like the component expect the button to be there, but for some reason in the HTML the code block actually looks like

<pre class="astro-code material-theme-palenight" style="background-color:#292D3E;color:#babed8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;" tabindex="0">
<!-- ... contents ... -->
</pre>

I have no idea where this HTML comes from as I cannot find any reference to the class astro-code in the codebase.

lazybobcat avatar Mar 23 '24 15:03 lazybobcat

Hi guys! If you want, I can handle this problem when I have time. Let me know :)

DomeT99 avatar Jun 09 '24 21:06 DomeT99