Preventing the HTML Editor From Wrapping Content in <p></p> Tags

Overview

You may face an issue related to the DNN HTML editor, such as the layout breaking after saving the changes. It may be due to the HTML elements being updated automatically, or because of the default behavior of the CKEditor, which wraps the content in <p></p> tags. This article provides the steps to handle such issues.

 

Affected Versions

DNN 8.3+

 

Requirements

CKEditor

 


Resolution

 

Resolution #1

  1. Go to Settings.

  2. Click Site Settings.

  3. Click Site Behavior.

  4. Click More.

  5. Open the HTML Editor Manager.

  6. Click Editor Config.

  7. Uncheck AutoParagraph and AutoUpdateElement.

    Screen_Shot_2020-02-19_at_11.51.51_AM.png

Resolution #2

If the above solution does not work and you are using list elements in your HTML code, this may be the default behavior of the CKEditor as it handles the paragraph and list elements as separate blocks. Therefore, it ends up moving the <p> elements outside of the <ul> tags to prevent nested blocks before saving the content.

  • It is recommended to refactor the code in order to use <li> tags instead of <p> tags for content inside the list.
  • Alternatively, the code with the nested blocks is saved without any issues when using the basic editor instead of the Advanced one (CKE).

 

Follow the steps below to access the basic editor:

  1. Go to a page and into Edit (Screen_Shot_2020-02-18_at_3.37.56_PM.png) mode.

    2020-02-12_1742.png

  2. Click on an HTML module and click the <> button.

    2020-02-12_1742_001.png

 


Validation

Content entered into the HTML editor will no longer be wrapped in <p></p> tags.

 

Back to top

Comments

0 comments

Article is closed for comments.