Closed Bug 674861 Opened 8 years ago Closed 8 years ago

contentEditable lists should not be splittable

Categories

(Core :: Editor, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: kaze, Assigned: kaze)

References

Details

Attachments

(2 files, 2 obsolete files)

In design mode, pressing [Return] twice in a list (ol, ul, dl) splits the list and inserts a paragraph. When the list is the active editing host, it should not be split.

Reproducible: Always

Steps to Reproduce:
1. create an empty HTML file with the following code:
    <ul contenteditable>
        <li> foo </li>
        <li> bar </li>
    </ul>
2. put the caret at the end of the first list item
3. press [Return] twice
4. the resulting code is:
    <ul contenteditable>
        <li> foo </li>
    </ul>
    <p> <br _moz_dirty> </p>
    <ul contenteditable>
        <li> bar </li>
    </ul>

Expected Results:
    <ul contenteditable>
        <li> foo </li>
        <li> <br _moz_dirty> </li>
        <li> <br _moz_dirty> </li>
        <li> bar </li>
    </ul>
bug 597349 and bug 570144 might be related.
Assignee: nobody → kaze
Status: NEW → ASSIGNED
Attached patch patch proposal (obsolete) — Splinter Review
Attached file testcase
Attached patch patch proposal (obsolete) — Splinter Review
slightly factorized code + unit tests
Attachment #549776 - Attachment is obsolete: true
Attachment #549839 - Flags: review?(ehsan)
Comment on attachment 549839 [details] [diff] [review]
patch proposal

Review of attachment 549839 [details] [diff] [review]:
-----------------------------------------------------------------

::: editor/libeditor/html/nsHTMLEditRules.cpp
@@ +6782,2 @@
>    // if we are in an empty listitem, then we want to pop up out of the list
> +  // but only if prefs says it's ok and if the parent isn't the active editing host.

Nit: if the list container isn't the active editing host.
Attachment #549839 - Flags: review?(ehsan) → review+
Attached patch patch proposalSplinter Review
same patch w/ fixed comment.
Attachment #549839 - Attachment is obsolete: true
Attachment #550096 - Flags: review?(ehsan)
Comment on attachment 550096 [details] [diff] [review]
patch proposal

(You didn't really need a review for this one :-)
Attachment #550096 - Flags: review?(ehsan) → review+
Pushed to inbound.
http://hg.mozilla.org/mozilla-central/rev/6ea906365d1f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Depends on: 680279
You need to log in before you can comment on or make changes to this bug.