#2395: InsertHtml() can prefix an additional annoying blank paragraph with IE
---------------------+------------------------------------------------------
Reporter: MarkWB | Owner:
Type: Bug | Status: new
Priority: Normal | Milestone: FCKeditor 2.6.3
Component: General | Version: SVN
Keywords: |
---------------------+------------------------------------------------------
If content being inserted is not being inserted into a block level
element, but itself begins with a block level element (e.g.
<p>insertion</p>), then this results in the extra blank prefixed
paragraph.
Following are lines 165 through 173 (as of 07/19) of the InsertHtml()
function in the 'internals/fck_ie.js' file.
{{{
// Using the following trick, any comment in the beginning of the
HTML will
// be preserved.
html = '<span id="__fakeFCKRemove__"
style="display:none;">fakeFCKRemove</span>' + html ;
// Insert the HTML.
oSel.createRange().pasteHTML( html ) ;
// Remove the fake node
FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode(
true ) ;
}}}
This 'trick' is what I find causing the extra beginning blank paragraph. I
suspect that pasteHTML() is making the HTML valid by putting the span
inside of a block level element (namely a <p> tag). Then the removal only
removes the span thus leaving the extra paragraph. ( <p> </p> )
I'd prefer having to embed a beginning comment in a tag due to omitting
this trick [which is what this ends up doing in this case anyway given
<!-- comment --><p>insert</p> to get <p><!-- comment --></p><p>insert</p>]
than have this paragraph added when inserting a block with no comment. In
other words, this 'trick' semi-fixes so few cases (none in my case) with
annoying expense for many use cases.
If preserving such comments is important, then replacing 'span' with 'p'
(or 'div') works in this particular case, but unacceptably breaks inline
insertions. Perhaps the appropiate way should be determined by looking at
the parent element. I've tried using elements that can be either block or
inline elements (e.g. object), but without success. They always get
treated like inline elements. (also work like span) So, unfortunately a
good solution for this problem isn't as simple as merely changing the tag.
--
Ticket URL: <http://dev.fckeditor.net/ticket/2395>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac