New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DLLs] DocumentListProperties' useAttribute is ignored due to styles in list.css #14613
Comments
I think making the following changes inside the ckeditor5-list plugin could fix this issue: documentlistpropertiesediting.js ...
setAttributeOnDowncast( writer, listStyle, element ) {
if ( listStyle && listStyle !== DEFAULT_LIST_TYPE ) {
if ( useAttribute ) {
const value = getTypeAttributeFromListStyleType( listStyle );
if ( value ) {
writer.setAttribute('class', 'ckeditor-list-type-attribute', element);
writer.setAttribute( 'type', value, element );
return;
}
} else {
writer.setAttribute('class', 'ckeditor-list-type-style', element);
writer.setStyle( 'list-style-type', listStyle, element );
return;
}
}
writer.removeStyle( 'list-style-type', element );
writer.removeAttribute( 'type', element );
},
... list.css .ck-content ol.ckeditor-list-type-style {
list-style-type: decimal;
& ol {
list-style-type: lower-latin;
& ol {
list-style-type: lower-roman;
& ol {
list-style-type: upper-latin;
& ol {
list-style-type: upper-roman;
}
}
}
}
}
.ck-content ul.ckeditor-list-type-style {
list-style-type: disc;
& ul {
list-style-type: circle;
& ul {
list-style-type: square;
& ul {
list-style-type: square;
}
}
}
} |
Thanks for the detailed bug report and suggested fix, @sbt99! 👏 This blocks Drupal from adopting CKEditor 5's native (and AWESOME!) |
FYI: we have some pretty crazy live-CSS-rewriting in that Drupal issue to work around this bug:
|
Suggested fix in content css:
.ck-content ol:not([type]) {
list-style-type: decimal;
& ol:not([type]) {
list-style-type: lower-latin;
& ol:not([type]) {
list-style-type: lower-roman;
& ol:not([type]) {
list-style-type: upper-latin;
& ol:not([type]) {
list-style-type: upper-roman;
}
}
}
}
}
.ck-content ul:not([type]) {
list-style-type: disc;
& ul:not([type]) {
list-style-type: circle;
& ul:not([type]) {
list-style-type: square;
& ul:not([type]) {
list-style-type: square;
}
}
}
} |
The above is breaking to-do list styling. This needs to be double-checked. |
📝 Provide detailed reproduction steps (if any)
CKEditor5.list.DocumentList
andCKEditor5.list.DocumentListProperties
inside theplugins
array where the editor is initialized (see full file posted below)✔️ Expected result
Selecting a list style will also apply the corresponding list icon of the selected style to the list.
❌ Actual result
The corresponding list icon of the selected list style is not applied to the list inside the editor. This happens due to the styles in list.css which is included unconditionally and thus overrides the type attributes default style applied by the browser.
❓ Possible solution
<ul>
and<ol>
tags if theuseAttribute
config is true and adapt the CSS inlist.css
such that the styles won't apply if that class exists.list.css
file only if theuseAttribute
config isn't set or false.📃 Other details
Full
dll.html
file that reveals the problem when adding to a generated package and opening it in a browser:If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: