SoFunction
Updated on 2025-04-07

Solutions to the problem of unnecessary blank lines in UEditor editing articles

The newly written website uses UEditor as an editor, but it turns out that every time you edit, there will be more empty lines at the beginning and end, like this:

Copy the codeThe code is as follows:

<p></p>
<br/>
xxxxxx
<br/>
<p></p>

Then I looked at the way I wrote it when I implanted it into the editor and found out the problem.

Copy the codeThe code is as follows:

<script name="content" type="text/plain">
<?=$info['content']?>
</script>
<script type="text/javascript">
var editor = ('container', {
 initialFrameWidth:"100%",
 initialFrameHeight:450
})
</script>

In container, there is a carriage return before and after <?=$info['content']>, and ueditor automatically converts these two carriage return into the form of <p></p></br>. The solution is very simple, just write it in one line.
Copy the codeThe code is as follows:

<script name="content" type="text/plain"><?=$info['content']?></script>
<script type="text/javascript">
var editor = ('container', {
 initialFrameWidth:"100%",
 initialFrameHeight:450
})
</script>