sleemanj / xinha

WYSIWYG HTML Editor Component (turns <textarea> into HTML editors)
http://trac.xinha.org/
Other
13 stars 2 forks source link

Backspace in nested lists should dedent to parent list (Trac #1616) #1616

Closed sleemanj closed 3 years ago

sleemanj commented 10 years ago

When using nested lists, if the cursor is at the start of a list item, pressing backspace should dedent that list item, one level per keypress, until it is at the same level as the preceding list item. Only then should the current behavior (browser default) kick in: list item itself removed, with its contents collapsed into the preceding list item if present, or removed from the list itself if there is no previous sibling in the list.

== Case 0

Pressing backspace with the cursor at ^Point 1 should cause "Point 1" to precede the list altogether. The list should then start with "Point 2" as its first list item.

(Pressing backspace with the cursor at ^Point 2 should cause "Point 2" to follow the list altogether. The list should then end with "Point 1" as its last list item.

== Case 1

Pressing backspace with the cursor at ^Subpoint 2 should result in " Subpoint1 Subpoint 2". (This case is almost handled correctly, but no space is inserted; you end up with " Subpoint 1Subpoint 2".)

== Case 2

Pressing backspace with the cursor at ^Subpoint 1 should result in

(Pressing backspace a second time without moving the cursor would be an instance of Case 1.)

== Case 3

#!html
<ul>
 <li>Point 1</li>
  <ul>
    <ul><li>Subpoint 1</li></ul>
    <li>Subpoint 2</l1>
  </ul>
</ul>

Pressing backspace with the cursor at ^Subpoint 1 should result in

Reported by ejucovy, migrated from http://trac.xinha.org/ticket/1616

sleemanj commented 10 years ago

ejucovy changed description from:

When using nested lists, if the cursor is at the start of a list item, pressing backspace should dedent that list item, one level per keypress, until it is at the same level as the preceding list item. Only then should the current behavior (browser default) kick in: list item itself removed, with its contents collapsed into the preceding list item if present, or removed from the list itself if there is no previous sibling in the list.

== Case 0

  • Point 1
  • Point 2

Pressing backspace with the cursor at ^Point 1 should cause "Point 1" to precede the list altogether. The list should then start with "Point 2" as its first list item. (This case is handled correctly by the current behavior.)

== Case 1

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 2 should result in "* Subpoint1Subpoint 2"

== Case 2

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
  • Subpoint 1
    • Subpoint 2

(Pressing backspace a second time without moving the cursor would be an instance of Case 1.)

== Case 3

#!html
<ul>
 <li>Point 1</li>
  <ul>
    <ul><li>Subpoint 1</li></ul>
    <li>Subpoint 2</l1>
  </ul>
</ul>

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
    • Subpoint 1
    • Subpoint 2

to:

When using nested lists, if the cursor is at the start of a list item, pressing backspace should dedent that list item, one level per keypress, until it is at the same level as the preceding list item. Only then should the current behavior (browser default) kick in: list item itself removed, with its contents collapsed into the preceding list item if present, or removed from the list itself if there is no previous sibling in the list.

== Case 0

  • Point 1
  • Point 2

Pressing backspace with the cursor at ^Point 1 should cause "Point 1" to precede the list altogether. The list should then start with "Point 2" as its first list item. (This case is handled correctly by the current behavior.)

Pressing backspace with the cursor at ^Point 2 should cause "Point 2" to follow the list altogether. The list should then end with "Point 1" as its last list item. (This case is handled correctly by the current behavior.)

== Case 1

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 2 should result in " Subpoint1 Subpoint 2". (This case is almost handled correctly, but no space is inserted; you end up with " Subpoint 1Subpoint 2".)

== Case 2

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
  • Subpoint 1
    • Subpoint 2

(Pressing backspace a second time without moving the cursor would be an instance of Case 1.)

== Case 3

#!html
<ul>
 <li>Point 1</li>
  <ul>
    <ul><li>Subpoint 1</li></ul>
    <li>Subpoint 2</l1>
  </ul>
</ul>

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
    • Subpoint 1
    • Subpoint 2
sleemanj commented 10 years ago

Actually I think some of these are wrong... assigning to myself to rethink.

When using nested lists, if the cursor is at the start of a list item, pressing backspace should dedent that list item, one level per keypress, until it is at the same level as the preceding list item. Only then should the current behavior (browser default) kick in: list item itself removed, with its contents collapsed into the preceding list item if present, or removed from the list itself if there is no previous sibling in the list.

== Case 0

  • Point 1
  • Point 2

Pressing backspace with the cursor at ^Point 1 should cause "Point 1" to precede the list altogether. The list should then start with "Point 2" as its first list item. (This case is handled correctly by the current behavior.)

Pressing backspace with the cursor at ^Point 2 should cause "Point 2" to follow the list altogether. The list should then end with "Point 1" as its last list item. (This case is handled correctly by the current behavior.)

== Case 1

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 2 should result in " Subpoint1 Subpoint 2". (This case is almost handled correctly, but no space is inserted; you end up with " Subpoint 1Subpoint 2".)

== Case 2

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
  • Subpoint 1
    • Subpoint 2

(Pressing backspace a second time without moving the cursor would be an instance of Case 1.)

== Case 3

#!html
<ul>
 <li>Point 1</li>
  <ul>
    <ul><li>Subpoint 1</li></ul>
    <li>Subpoint 2</l1>
  </ul>
</ul>

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
    • Subpoint 1
    • Subpoint 2

to:

When using nested lists, if the cursor is at the start of a list item, pressing backspace should dedent that list item, one level per keypress, until it is at the same level as the preceding list item. Only then should the current behavior (browser default) kick in: list item itself removed, with its contents collapsed into the preceding list item if present, or removed from the list itself if there is no previous sibling in the list.

== Case 0

  • Point 1
  • Point 2

Pressing backspace with the cursor at ^Point 1 should cause "Point 1" to precede the list altogether. The list should then start with "Point 2" as its first list item.

(Pressing backspace with the cursor at ^Point 2 should cause "Point 2" to follow the list altogether. The list should then end with "Point 1" as its last list item.

== Case 1

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 2 should result in " Subpoint1 Subpoint 2". (This case is almost handled correctly, but no space is inserted; you end up with " Subpoint 1Subpoint 2".)

== Case 2

  • Point 1
    • Subpoint 1
    • Subpoint 2

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
  • Subpoint 1
    • Subpoint 2

(Pressing backspace a second time without moving the cursor would be an instance of Case 1.)

== Case 3

#!html
<ul>
 <li>Point 1</li>
  <ul>
    <ul><li>Subpoint 1</li></ul>
    <li>Subpoint 2</l1>
  </ul>
</ul>

Pressing backspace with the cursor at ^Subpoint 1 should result in

  • Point 1
    • Subpoint 1
    • Subpoint 2
sleemanj commented 10 years ago

Not required now ListOperations is available for tab/shift-tab