ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.8k stars 2.48k forks source link

Not possible to delete two lists selected by text #4875

Closed jswiderski closed 3 years ago

jswiderski commented 3 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open e.g. https://nightly.ckeditor.com/21-09-08-06-03/full/samples/
  2. Switch to source mode and paste the following HTML
    
    <p>begin</p>

middle


3. Select everything from first list item (t1) to last list item in the second list (t22)
![obraz](https://user-images.githubusercontent.com/5314687/132509963-545dbf80-a85b-42e2-b043-6ea1df73eca3.png)
4. Press delete or backspace

### Expected result
Whole text gets deleted.

### Actual result

Only second list gets deleted.
![obraz](https://user-images.githubusercontent.com/5314687/132510216-cbcfdd88-1397-4e48-ab17-2777c2ff7bdf.png)

## Other details

*   Browser: Any
*   OS: Any
*   CKEditor version: 4.0 (I could reproduce it in 4.0)
*   Installed CKEditor plugins: list
KarolDawidziuk commented 3 years ago

First thoughts.

When we add another list and select three as in the example above, only the last list will be removed. When we add an empty paragraph before the first list it's been working. In this place we're checking whether the entire list has been selected, but for some reason it seems that only the first list has been selected as a whole, returning range from the last and removing it.

If we don't select the entire list the content will be removed from a selected range, not from the range returned by the above-mentioned function. At this moment we can try to update getSelectedTableList() function to check if we have selected more than one whole list and return the range with startContainer pointing to the beginning of the first selected list.

CKEditorBot commented 3 years ago

Closed in https://github.com/ckeditor/ckeditor4/pull/4943