Closed Bug 57477 Opened 24 years ago Closed 23 years ago

Moving text from one <LI> to another <LI> does the wrong thing

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: kmcclusk, Assigned: mozeditor)

References

Details

(Whiteboard: [list][QAHP] fix in hand, will check in soon)

Attachments

(3 files)

To reproduce:

1. load the attachment in composer
2. select the <Move under heading1> text
3. ctrl-c to copy to clipboard
4. Click on the <LI> under heading1
5. ctrl-v to paste

Expected:
The selected text should be pasted next to the heading 1 list item.
<this is what happens in 4.x>

What happens:
The selected text is placed in a new nested <LI> underneath the first heading.


If you load the attachment into composer


This is a bug that I run into every week when preparing my status report.

The test case was built using N6-composer.
This bug makes it difficult to produce my weekly status report. I normally copy
and paste items from emails into my status template which contains pre-existing
<LI>'s.
The following is the result of saving the file after doing the paste.

heading1<br>
<ul>
  <li>
    <ul>
      <li>Move under heading1</li>
    </ul>
    <br>
  </li>
</ul>
<br>
heading2<br>
<ul>
  <li>Move under heading1</li>
</ul>

A <ul> and <li> have been placed around the outside of the text that was pasted.
I tried various ways of selecting the text. Triple clicking/ dragging from
right, dragging from the left, they all yield the same results.

I am using branch build 2000102008.
trible click will select the text and surrounding element structure, dbl-click
selects just the text, but just in case something else is going on here, asking
joe to take a look
Assignee: beppe → jfrancis
Target Milestone: --- → mozilla0.9
This is actually working as designed (beleive it or not!).  When you copy, we 
have no way to know if you mean to copy the text, the li, or the ul.  Our 
strategy is to copy the outmost element for which all the children are selected.  
This may seem wrong here but if you had a three item list and selected across all 
three items it would suddenly seem very right.  

Even though I think the copy behavior is correct, that doesn't mean we shouldn't 
change the paste behavior.  Probably most users would prefer that lists get 
merged into other lists on paste, rather than sublisted.  I'm going to give that 
I try and see what folks think.

cc'ing a random assortment of others to get comments.
Status: NEW → ASSIGNED
*** Bug 57718 has been marked as a duplicate of this bug. ***
In case anyone needs a workaround for now: note Joe's comment about *all* the
children being selected.  If you omit one character at the beginning or end of
the selected text, then it won't include the parent.  You'll have to type that
one character again, of course.

Adding Lisa because she asked me a similar question (or filed a bug, I forget
which) recently and may want to track this if the behavior changes.
Yes, I was confused when this happened to me.  The workaround was fine for me.
I just could not figure out how to copy text only from a table cell without
having the entire table cell being pasted!
hmmm.  no one ever gave me comments on my proposal.  adding charlie, since he is
always good for a good comment!
I'll comment: the current behavior seems better than the opposite, of not
copying the enclosing structure (we got more complaints when we did that, and
that's why we made it work this way).

However, we could be even smarter, e.g. paste could notice that it contains only
list items, and is being pasted into an empty list item (is that pretty much
what's happening here?) and merge the pasted list items into the existing list.
 That might be a step toward doing what most users expect (and if the user
really did want a sublist, it would be easy to create one then paste into that
empty list item, or highlight the desired sublist items and click indent).

Being that smart sounds like it might be a lot of work, though, and probably not
a high priority.
While I agree with Joe that we should copy parent block elements, such as LI and
OL, when the all of list item is selected. There are cases, such as pasting
into an existing list, where pasting should insert a new list item (merged into
the destination list, thus the OL in the copy source is ignored.)
In cases where you paste into a non-list block, it seems to me that you
shouldn't paste the LI and OL.
moving a bunch of 0.9 bugs to 0.9.1
Target Milestone: mozilla0.9 → mozilla0.9.1
Whiteboard: [QAHP]
Target Milestone: mozilla0.9.1 → mozilla0.9.2
this behavior is intentional.  Beth will add a dependency on another bug 
momentarily, for giving the user choice at copy time.
From a usability standpoint, I see two things that would make this less of an 
issue for users:
 * pasting being smarter (notice that an li is being inserting into an li and 
insert them relative to the current levels, not increasing levels)
 * making the increase/decrease of margins work correctly for lists as well as 
blockquotes (this would allow users to easily remove extra list levels).

This second issue isn't really the same as this bug and should be covered in an 
existing bug or filed as a new bug.
Whiteboard: [QAHP] → [list][QAHP]
attached a patch that fixes this (additional pasting smarts for lists).
Whiteboard: [list][QAHP] → [list][QAHP] fix in hand
Whiteboard: [list][QAHP] fix in hand → [list][QAHP] fix in hand, need r=, sr=
r=brade
note: this also seems to fix bug #66579 so I'm adding the dependency
Blocks: 66579
I have tested the latest patch (6/13/01); it works very well.  r=brade
Whiteboard: [list][QAHP] fix in hand, need r=, sr= → [list][QAHP] fix in hand, need sr=, a=
kin just sr'd this for me, modulo sme changes he requested which I will make.
Whiteboard: [list][QAHP] fix in hand, need sr=, a= → [list][QAHP] fix in hand, need a=
a= asa@mozilla.org for checkin to the trunk.
(on behalf of drivers)
Blocks: 83989
Whiteboard: [list][QAHP] fix in hand, need a= → [list][QAHP] fix in hand, will check in soon
fix checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
this is fixed, however, after performing step 5) we add an extra
bullet. I don't like this behavior.

Beth has sent Joe a note on this, I might file a bug.

but I will mark this bug verified-fixed because it is a different issue
which is fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: