Opened 13 years ago

Closed 13 years ago

#8396 closed Bug (invalid)

<p> inside <strong> inside <p> erases all the text beneath

Reported by: Daniel Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.6.6
Keywords: Cc: vedmack@…

Description

Hi

First of all i'm using FCKeditor 2.6.2 version (2.6.6 gives a bit different error - which i will describe beneath)

In order to recreate the bug in the text editor I entered the source mode of the editor (clicked the source button in the toolbar) and typed :

<p>one</p>
<p><strong><p>two</p></strong></p>
<p>three</p>

notice the "<p>two</p>" between the strong tags

not if u switch back to normal mode and i see the one two three

in the editor , and i select the entire "two" word and click on the "bold" button on the toolbar i get the line being deleted and the line beneath it too...

if I type the same text but without the extra <p> tags inside the <strong> tag all works well, this is looks like this

<p>one</p>
<p><strong>two</strong></p>
<p>three</p>

NOW, i did some debugging and found out that in the fckstyles.js file in the RemoveFromRange function , when i got the extra <p> tags the FCKEDITOR recognize the word "two" as DispHTMLDocument node with NodeType= 3 and NodeName= #text

While without the extra <p> node the FCKEDITOR recognize the word "two" as DispHTMLPhraseElement node with NodeType= 1 and NodeName= #STRONG,

How can it be fixed? cause I only gave a simple example, but this happens in larger text in which for some reasons the extra <p> appears allot!

Same input in 2.6.6 version gives the following results after selecting the "two " word (with a little space after it) and click on the bold button i get js error object required in fckdomtools.js cause existingNode and after I click yes/no in the alert message the source of the text looks like this

<p>one</p>
<p>
<p>&nbsp;</p>
<p>three</p>
</p>
<p><span id="1316587844776S" style="display: none">&nbsp;</span>two</p>
<p><span id="1316587844745E" style="display: none">&nbsp;</span></p>

if i select only the "two" without any spaces before or after the source of the text looks like this

<p>one</p>
<p>
<p>&nbsp;</p>
<p>three</p>
</p>
<p>two</p>

notice that in both cases the "two" being shifted to the bottom of the page

Thanks ahead,

Regards,

Daniel.R

Change History (1)

comment:1 Changed 13 years ago by Jakub Ś

Keywords: 2.6.2 2.6.6 removed
Resolution: invalid
Status: newclosed

FCKeditor was retired and is no longer supported. All active development was moved to its predecessor, CKEditor 3.x, that is a fully mature and far superior product. We recommend you upgrade as soon as possible.

Second - what you have shown me is invalid HTML. You are closing block elements inside inline elements.

NOTE: After you upgrade to CKEditor and you will test the same code you will get

<p>one</p>
<p>&nbsp;</p>
<p><strong>two</strong></p>
<p>&nbsp;</p>
<p>three</p>

This is becuse browser sees your code as:

<p>one</p>
<p><strong></strong></p><p><strong>two</strong></p><p></p>
<p>three</p>

Empty inline elements will be removed and blocks will be filled with &nbsp;

You can test this using the code below:

<html>
<head>
	<script type="text/javascript">
window.onload = function ()
{
	alert( document.body.innerHTML );
}
	</script>
</head>
<body>
<p>one</p>
<p><strong><p>two</p></strong></p>
<p>three</p>
</body>
</html>

There are two solutions either start using valid HTML or use the CKEditor protect source feature to leave his specific code alone.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy