Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9578 closed Bug (wontfix)

VIew source: Incorrect handling of inline elements

Reported by: Richard Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description

If supply a custom 'contentsCss' CSS file, and within that CSS file I set all paragraphs to be inline, then the editor correctly adds <br/> elements when pressing the return key in the editor. If I then click the 'Source' button to view the source, it shows empty paragraphs with non-breaking spaces, instead of <br />'s.

Change History (4)

comment:1 Changed 7 years ago by Richard

I forgot to mention, I'm using Chrome version 22 on Linux.

comment:2 Changed 7 years ago by Frederico Caldeira Knabben

Status: newpending

Do you mean that you have this?

p {
    display: inline;
}

If yes... well, that's a very uncommon use case. I'm still having problems to find a use for it.

The main problem is that the <p> element is essential for the editor operations, especially when it comes to ENTER, and it's always considered to be a block (we don't check if it has been hacked on CSS). So, I'm finding it hard to search for a solution if we'll not have a very good reason for it.

Comments?

comment:3 Changed 7 years ago by Richard

I found this issue as a result of testing something else, and I agree it's not a common use case, but I feel it reflects a bigger issue:

I believe that CKEDITOR.dataProcessorView.toHtml() is used to format data/HTML to be inserted into the editor. This method also removes all line break white-space characters between nodes. If you had set block levels to be inline (for whatever reason), then the text that the user sees will not be correct and will contain concatenated words.

If the user relies on whitespace to separate words, then I don't think the editor should be removing those white space characters.

What's the reasoning for removing the whitespace characters?

comment:4 Changed 7 years ago by Jakub Ś

Resolution: wontfix
Status: pendingclosed

What's the reasoning for removing the whitespace characters?

Paragraphs, which are block-level elements by default, don't need white spaces between them (each paragraph starts new line). Such white spaces are unnecessary overhead and all they do is take up space (little but still) in limited browser memory.

it's not a common use case

Yes, chancing the "block" definition of all paragraphs in a page is not a common practice. Personally I haven’t seen such use case anywhere.

There is huge number of cases that could bring similar issues. It is impossible for the editor to handle them all. We do have some level of fixing for most common cases. This is just not one of them.

Simple solution and correct one is using spans – inline elements by definition. That way editor will have no problem processing them.

Last edited 7 years ago by Jakub Ś (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy