#2403: When in div mode inside a <p>, a new <p> is created on enter
-----------------------------+----------------------------------------------
Reporter: neilj | Owner:
Type: New Feature | Status: new
Priority: Normal | Milestone:
Component: UI : Enter Key | Version:
Resolution: | Keywords:
-----------------------------+----------------------------------------------
Comment(by neilj):
Sorry, there was a bug in the original patch where if you were inside a
list, hitting enter would give you a new line rather than a new list item.
I think that may be forcing the mode a bit too much. I've put the new
patch inline at the bottom of this message. Please ignore the attached
one.
I feel my original explanation of this new feature/bug fix was a bit
inadequate, so to see the difference from the current version consider the
following:
1. The editor is in 'div' mode.
2. The starting html of the editor is preset to the following:
{{{
#!text/html
<p>This is some <strong>sample text</strong>. You are using <a
href="http://www.fckeditor.net/">FCKeditor</a>.</p>
<p>A little more text</p>
<p>And a bit more.</p>
}}}
3. Whilst inside one of the paragraphs, you hit enter. If you are in the
middle of the paragraph, it is simply split in two with both options. But
if you are at the beginning or end, the behaviour differs:
Behaviour with patch (and option enabled) - a new <div> is inserted
before/after paragraph as appropriate.
Behaviour without patch (or option disabled) - a new <p> is inserted
before/after paragraph as appropriate.
Updated patch:
{{{
#!diff
Index: classes/fckenterkey.js
===================================================================
--- classes/fckenterkey.js (version 2.6.3b)
+++ classes/fckenterkey.js (working copy)
@@ -478,13 +478,13 @@
// If is a header tag, or we are in a
Shift+Enter (#77),
// create a new block element (later in
the code).
- if ( !this._HasShift &&
!(/^H[1-6]$/).test( sPreviousBlockTag ) )
+ if ( !this._HasShift &&
!(/^H[1-6]$/).test( sPreviousBlockTag ) && ( !FCKEditor.ForceEnterMode ||
sPreviousBlockTag == 'LI' ) )
{
// Otherwise, duplicate the
previous block.
eNewBlock =
FCKDomTools.CloneElement( ePreviousBlock ) ;
}
}
- else if ( eNextBlock )
+ else if ( eNextBlock && !FCKEditor.ForceEnterMode
)
eNewBlock = FCKDomTools.CloneElement(
eNextBlock ) ;
if ( !eNewBlock )
}}}
--
Ticket URL: <http://dev.fckeditor.net/ticket/2403#comment:1>
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