#6141 closed Bug (fixed)
Indent plugin: outdenting list with indentOffset=0 doesn't work
| Reported by: | Arne | Owned by: | Sa'ar Zac Elias |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.4.2 |
| Component: | Core : Lists | Version: | |
| Keywords: | Cc: |
Description
- Configure indentOffset in list plugin to 0
- Create a list with two items
- Indent the second item.
- Outdent the second item.
Suggested fix: Modify the following lines in the indentElement function in the list plugin:
if ( currentOffset < 0 ) return false;
To :
if ( currentOffset <= 0 ) return false;
Attachments (5)
Change History (30)
comment:1 Changed 15 years ago by
| Summary: | List plugin: outdenting list with indentOffset=0 doesn't work → Indent plugin: outdenting list with indentOffset=0 doesn't work |
|---|
comment:2 Changed 15 years ago by
| Component: | General → Core : Lists |
|---|---|
| Milestone: | → CKEditor 3.4.1 |
Changed 15 years ago by
| Attachment: | 6141.patch added |
|---|
comment:3 Changed 15 years ago by
| Owner: | set to Sa'ar Zac Elias |
|---|---|
| Status: | new → review |
comment:4 Changed 15 years ago by
| Status: | review → review_failed |
|---|
After using the patch following TC fails:
- Use following content:
<ul> <li> foo</li> <li> bar</li> </ul>
- Indent "bar" twice
- Oudent "bar" once
- Result: "bar" is not indented
- Expected: "bar" is indented with one level
comment:5 Changed 15 years ago by
I believe this will work better :
if ( currentOffset < 0 || (currentOffset == 0 && self.name == 'outdent')) {
return false;
}
Changed 15 years ago by
| Attachment: | 6141_2.patch added |
|---|
comment:6 Changed 15 years ago by
| Status: | review_failed → review |
|---|
comment:7 Changed 15 years ago by
| Status: | review → review_failed |
|---|
With second patch, list outdent stopped working (both TCs from this ticket fail).
Changed 15 years ago by
| Attachment: | 6141_3.patch added |
|---|
comment:8 Changed 15 years ago by
| Status: | review_failed → review |
|---|
Changed 15 years ago by
| Attachment: | 6141_4.patch added |
|---|
comment:9 Changed 15 years ago by
| Status: | review → review_failed |
|---|
The purpose of having 'config.indentOffset' set to 0 is to disable normal paragraph indentation while keep the list transformation (am I right Arne?), the patch should simply allow this to happen with an explicit check.
comment:10 Changed 15 years ago by
Yes, that is the purpose. We don't want the user to be able to indent the list items beyond their list levels.
comment:11 Changed 15 years ago by
| Keywords: | Discussion added |
|---|---|
| Status: | review_failed → review |
The way I see it, if the list has indentation, it should be removed (just like every block) and only in the the second click its items should be transformed into paragraphs.
comment:13 Changed 15 years ago by
Replying to garry.yao:
@Saar, are you asking for review on 6141_4?
Asking for review on 6141_3 again actually, I explained the reason in comment:11 and in our conversation a few days ago.
comment:15 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed with [5917].
comment:16 Changed 15 years ago by
| Keywords: | Discussion removed |
|---|
comment:17 Changed 15 years ago by
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
This fix breaks indentation with custom class name instead of styling, as the following case:
- Use the 'indentClasses' config and update content styles;
config.indentClasses = ['Indent1', 'Indent2', 'Indent3']; .Indent1{ margin-left:20px; } .Indent2{ margin-left:40px; } - Indent at least two times on a single list item.
- Outdent the indented list item.
- Actual Result: The first outdent transforms the list into paragraph.
comment:19 Changed 15 years ago by
| Status: | reopened → review |
|---|
It's not a regression of the fix, as I can still reproduce the bug after the fix was reverted. That's another bug, and we should make sure there is a ticket about it. Asking for another review of 6141_3.
comment:20 Changed 15 years ago by
| Status: | review → review_failed |
|---|
@Saar, it seems you're right on that the test case is not working originally, but by looking the patch the following logic is problematic by assuming that the indentation is always based on inline style, those lines would better keep unchanged IMO:
if ( !( indentWholeList &&
( self.name == 'indent' || parseInt( nearestListBlock.getStyle( getIndentCssProperty( nearestListBlock ) ), 10 ) ) &&
indentElement( nearestListBlock ) ) )
indentList( nearestListBlock );
#6447 opened for the above TC.
Changed 15 years ago by
| Attachment: | 6141_5.patch added |
|---|
comment:21 Changed 15 years ago by
| Status: | review_failed → review |
|---|
comment:22 Changed 15 years ago by
| Status: | review → review_passed |
|---|
comment:23 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed with [2928].
comment:25 Changed 15 years ago by
Setting indentOffset=0 results in an indentation of 40px because the test in the following code will evaluate the value of zero to false and return 40:
var indentOffset = editor.config.indentOffset || 40;
in the indentElement function in the indent plugin.

Sounds reasonable, considering that the fix can be that small.