Opened 10 years ago

Closed 10 years ago

#8604 closed Bug (invalid)

Redundant blank space in the html output for one empty paragraph

Reported by: IBM_RQM Owned by:
Priority: Normal Milestone:
Component: Core : Output Data Version:
Keywords: Cc:

Description

Severity: High

This issue occurs for the empty paragraph.

The steps to reproduce:

  1. In the editor input one empty paragraph.
  2. Using CKEditor's getData() method to get the html data of the whole text.

Expected Result: The empty paragraph's html code is '<p></p>' Actual Result: There is one redundant blank space in the html code, i.e., '<p>&nbsp;</p>'

Attachments (3)

html_code_getby_ckeditor's_getData().png (220.5 KB) - added by IBM_RQM 10 years ago.
Input_empty_para_in_editor.png (138.2 KB) - added by IBM_RQM 10 years ago.
View_dom_on_firebug_when_edit_in_editor.png (209.0 KB) - added by IBM_RQM 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by IBM_RQM

Changed 10 years ago by IBM_RQM

Changed 10 years ago by IBM_RQM

comment:1 Changed 10 years ago by IBM_RQM

Correct the Expected Result, the empty paragraph's html code is '<p><br/></p>'

comment:2 Changed 10 years ago by IBM_RQM

Could I get an update of this defect status. Thanks!

comment:3 Changed 10 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 3.6.2

Correct the Expected Result, the empty paragraph's html code is '<p><br/></p>'

This is how Firefox sees those nodes (the same is with Opera). By default CKEditor fills empty blocks with &nbsp; to render them correctly.

You can change this behavior when using: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.fillEmptyBlocks
That way you will have <p></p> insttead of <p>&nbsp;</p>

You can check this when inserting two empty paragraphs in source mode, switching to wysiwyg and then using getData().

If you are wondering why by default this does not work with one paragraph then check this link: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.ignoreEmptyParagraph

Note: See TracTickets for help on using tickets.
© 2003 – 2021 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy