Why does the custom code always have an DIV-Tag around with 2 lines??

I insert a custom code and edit it. I get <div>Custom Code</div> In the html view appears correct <div>Custom Code</div>

Now I edit the code... deleting the default div and insert <h1>test</h1>

Everything correct in the html-view.

Now I add a second line with <h1>test</h1>

In the custom code editor appears correctly


but in the html-view appears an additional <div>


This is a limitation to how Custom Code works in the app. Every component must expose a single top-level DOM element, which is why your h1 elements are wrapped in a div.

This is only in the app - in Preview and when exporting the code is included exactly as you've written it.