Opened 10 years ago

Closed 9 years ago

#428 closed Bug (duplicate)

IE problems created unordered list from pasted list

Reported by: mkoepke Owned by: martinkou
Priority: Normal Milestone: FCKeditor 2.5 Beta
Component: General Version: SVN (FCKeditor) - Retired
Keywords: Discussion Cc:

Description (last modified by martinkou)

IE is not working correctly when pasting a list of text.

  1. On test site with IE, paste the following list:
* Escape from "Corporate-Cubical Hell"
* A Series of Law-Lectures
* The Weather
* An Overnight Jazz D.J.
* A 6-Pack on my Patio
  1. Highlight text and hit bulleted list toolbar item.
  1. Only a single bullet is created on the line above the Escape... line

Source code generated:

    <li><br />
    * Escape from &quot;Corporate-Cubical Hell&quot;<br />
    * A Series of Law-Lectures<br />
    * The Weather<br />
    * An Overnight Jazz D.J.<br />
    * A 6-Pack on my Patio</li>

Same behavior is pasting with Ctrl+v, Paste toolbar, Paste as Plain Text, or Paste from Word (with Ctrl+v)

FF generates a bulleted list using the steps above. Source code:

    <li>* Escape from &quot;Corporate-Cubical Hell&quot;</li>
    <li>* A Series of Law-Lectures</li>
    <li>* The Weather</li>
    <li>* An Overnight Jazz D.J.</li>
    <li>* A 6-Pack on my Patio</li>

Change History (11)

comment:1 Changed 9 years ago by fredck

  • Milestone FCKeditor 2.4.3 deleted

comment:2 Changed 9 years ago by fredck

  • Keywords Discussion added
  • Milestone set to FCKeditor 2.5

The point here, which requires discussions, is how should we handle blocks with <br/> when EnterMode=p (or div)?

In a normal situation, lines separated by a <br/> represent a "single block". Each block is separated by <p>s.

I'm not saying that IE has the correct behavior, or Firefox is correct instead. But, we aim to provide the same results with both browsers.

I'm sure that, no matter which choice me make here, people will always be complaining that the editor doesn't behaves the other way. Maybe make it configurable, making the code much more complex?

comment:3 Changed 9 years ago by martinkou

  • Description modified (diff)

Tidied up the description to make it more readable.

comment:4 Changed 9 years ago by martinkou

If we use the behavior of "Paste As Plain Text" while the caret is inside a list as reference, it seems the behavior in IE, rather than in Firefox, is more consistent with the other parts of FCKeditor.

"Paste As Plain Text" inside a list, in EnterMode=p, as in the SVN version, works like this:

  1. If a single line break is encountered, no new list item is created. Instead, create a <br>.
  2. If double line breaks are encountered, create a new list item.

So, if you want to create a list by pasting in EnterMode=p, the currently most acceptable way is this:

* Escape from "Corporate-Cubical Hell"

* A Series of Law-Lectures

* The Weather

* An Overnight Jazz D.J.

* A 6-Pack on my Patio

Select the pasted text and press "Insert/Remove List", or create a list first and use the "Paste As Plain Text" button - it works the same in both IE and Firefox.

Note that the "single line break -> <br>, double line breaks -> new item" can be very counterintuitive for casual users, however. MS Word does not behave like that.

comment:5 Changed 9 years ago by martinkou

  • Owner set to martinkou
  • Status changed from new to assigned

comment:6 Changed 9 years ago by martinkou

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with [631].

Click here for more info about our SVN system.

comment:7 Changed 9 years ago by martinkou

  • Resolution fixed deleted
  • Status changed from closed to reopened

[631] does not work when EnterMode=br and trying to create list from the following HTML code:

line1<br />
line2<br />

comment:8 Changed 9 years ago by martinkou

Upon further consideration, it seems to me that simple preprocessing/postprocessing hacks, like the one implemented in [631], cannot suffice. There are far too many ways these simple hacks can go wrong, they are complicated themselves, and relying on IE's built-in list commands can bring other caveats (other than not be able to transform things separated by <br> into separate list items).

While I was trying to improve the preprocessing hack in [631] to make it work for the test case I suggested, I noticed that the hack got so complicated that its logical complexity wouldn't be too different than implementing the list insertion/deletion logic on our own.

If we were to implement our own list insertion/deletion logic, there are some guidelines available:

comment:9 Changed 9 years ago by martinkou

Oh, I almost forgot why I'm posting the message above. And I just noticed I was contradicting myself... the hacks in [631] and what I was trying to implement are not simple, but they are naive in assuming IE's editor list commands would work flawlessly after the items are split into <p> blocks.

If we were to implement the insert/delete list commands ourselves, we need to implement some DOM operations like finding the starting/ending point of a paragraph (need to account for things like <br> and <hr>), wrapping DOM nodes inside <ul>/<ol> and <li> elements, finding the right point to insert the <ul>/<ol> elements, etc. In my hindsight, I think the style system that Fred is implementing now (but still not in the SVN) could have some of these operations implemented, and I could use them instead of implementing my own from ground zero.

comment:10 Changed 9 years ago by martinkou

Oh my god, it seems the Trac system has a bug as well, and my last comment overrided Mike's comment. Good thing I can still see his comment in my email. Reposting here to set the record straight.

I didn't think that this a should be easy. 

What I do believe though in whatever the "right" answer is is that IE 
and FF should work the same.  With 2.4 that is now the case.  FF gives 
you a list and IE a single LI with all items pasted in.

Just make them work the same way.


comment:11 Changed 9 years ago by martinkou

  • Resolution set to duplicate
  • Status changed from reopened to closed

I've opened #1178 as a collection of list problems that are significant for v2.5.

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