[wp-trac] [WordPress Trac] #56893: Unnecessary line breaks added by the code editor that breaks JavaScript
WordPress Trac
noreply at wordpress.org
Mon Oct 24 06:23:11 UTC 2022
#56893: Unnecessary line breaks added by the code editor that breaks JavaScript
--------------------------+------------------------------
Reporter: sweetheatmn | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.0.3
Severity: critical | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Old description:
> adding a simple JavaScript to the code editor and hitting the publish
> button just adds unnecessary
> {{{
> </br>
> }}}
>
> inside the Javascript which is a sufficient reason to break any
> JavaScript
>
> How to reproduce, simply add a new post, paste/write any JavaScript and
> click the publish button to see the black magic
>
> [[Image(https://i.imgur.com/fyrAwtI.png)]]
>
> Regards,
> Atef
New description:
adding a simple JavaScript to the code editor and hitting the publish
button just adds unnecessary
{{{
<br />
}}}
inside the Javascript which is a sufficient reason to break any JavaScript
How to reproduce: simply add a new post, paste/write any JavaScript and
click the publish button to see the black magic
[[Image(https://i.imgur.com/fyrAwtI.png)]]
Regards,
Atef
--
Comment (by sabernhardt):
The automated paragraph bug with scripts in Classic Editor is very old:
#2833.
In the block editor, `script` tags in a paragraph block would behave
similarly. However, content within a ''Custom HTML'' block should not get
the inappropriate tags. Creating that block is easier in Visual mode, but
in Code view you could wrap scripts in the `wp:html` block comments:
{{{
<!-- wp:html -->
<script>
console.log('this');
</script>
<!-- /wp:html -->
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56893#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list