Indentation in lists isn't working
Steps to reproduce
- Type some text in the editor.
- Select it and press on list button.
- Then press in identate button
Expected behavior
The list is moved to the right
Current behavior
The list doesn't move
Inspecting the list with the development tools I can see that the list's class changes, that means that there are missing styles. I fixed this adding these styles to ckeditor.indentblock.css
p.Indent1, ul.Indent1, ol.Indent1 {
margin-left: 2em;
}
p.Indent2, ul.Indent2, ol.Indent2 {
margin-left: 4em;
}
p.Indent3, ul.Indent3, ol.Indent3 {
margin-left: 6em;
}
p.Indent4, ul.Indent4, ol.Indent4 {
margin-left: 8em;
}
p.Indent5, ul.Indent5, ol.Indent5 {
margin-left: 10em;
}
p.Indent6, ul.Indent6, ol.Indent6 {
margin-left: 12em;
}
p.Indent7, ul.Indent7, ol.Indent7 {
margin-left: 14em;
}
p.Indent8, ul.Indent8, ol.Indent8 {
margin-left: 16em;
}
p.Indent9, ul.Indent9, ol.Indent9 {
margin-left: 18em;
}
p.Indent10, ul.Indent10, ol.Indent10 {
margin-left: 20em;
}
Comments
Comment #2
meichr commentedHi fabanfiorotto,
thanks for reporting. Please give me several days to check this and return to you as I'm currently on the road.
Meichr.
Comment #3
meichr commentedUpdated!
Hi fabanfiorotto,
finally, I found time to reproduce the behavior you suggested.
I'm using Drupal 8.5.6 and the bundled CKEditor 4.8.0 and ckeditor_indentblock-8.x-1.0-beta1 for checking.
To reproduce the behavior, you also need to add the tags
<u class>and<ol class>to the field Allowed HTM tags. In the tested Drupal version and by using the Bartik standard theme the suggested css is overruled by the Drupal provided css which means, we need to add more specifity to the ul.Indent and ol.Indent selectors in the css. Please feel free to suggest a solution.Thanks again for the find. This is definitly worth to be included with the next release.
Meichr.
Comment #4
dsutter commentedJust wanted to contribute this patch file containing same code as above. I'm not sure that it's the best fix, but at least it gets something into the CKEditor and we can override the indent values in our theme.
Comment #5
idebr commentedIndentation of lists works differently in CKEditor:
Before indent:
After indent:
If the indented list has no margin, the
<ul>element does not have the necessary margin in css.Comment #6
thejimbirch commentedComment #7
thejimbirch commentedThe patch in #4 applies cleanly and adds support for indenting lists by adding the more CSS specificity.
@idebr Since the module takes over the indent buttons, the same class is applied to the UL/OL and the P, so the normal CKEditor behavior is overridden.
Users may need to add the tags
<ul class>and<ol class>to the field Allowed HTML tags. in their Text Formats as specified in #3Moving to RTBC.
Thanks for the patch @dsutter and the module @meichr!
Comment #8
yuseferi commented#4 works for me on Drupal 9.3 and plugin 4.17.1
Comment #10
heddnThanks everyone for your contributions.