Closed (outdated)
Project:
CKEditor List Style
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 May 2017 at 17:11 UTC
Updated:
6 Dec 2021 at 21:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joarferme commentedAdding the type attribute to the ordered and unordered list could fix this issue.
Go to the CKEditor library \libraries\liststyle\dialogs\liststyle.js
On lines 63-66 and 158-161
if ( value )
element.setStyle( 'list-style-type', value );
else
element.removeStyle( 'list-style-type' );
Replace these lines, to add the attribute type
if ( value ){
element.setStyle( 'list-style-type', value );
for(var tkey in mapListStyle){
if (mapListStyle[tkey]==value)
element.setAttribute( 'type', tkey );
}
} else {
element.removeStyle( 'list-style-type' );
element.removeAttribute( 'type' );
}
Comment #3
osmanAny text format with Limit allowed HTML tags and correct faulty HTML filter enabled will strip the style attribute from ANY tags. See FilterHtml class:
However, the CKEditor List Style plugin sets the list properties via inline styles.
Unfortunately this is the reason why Basic HTML and Restricted HTML filter types cannot use this feature, at least for the time being.
I explored some workarounds to the issue to no avail. Patches and suggestions are welcome.
Comment #4
adamcadot commentedPosting a patch based on joarferme's suggestion.
Applies to the recommended version (4.8.0) and the latest version (4.11.1) of the liststyle plugin.
Note: The patch must be in the
liststyledirectory. (Typically at/libraries/ckeditor/plugins/liststyle)Going forward, perhaps we should notify users that this patch exists by adding a warning to the module page. (Especially since the Limit allowed HTML tags and correct faulty HTML filter is a commonly used.)
Comment #5
piotrkonefal commentedThanks @adamcadot. The patch works fine! After patching the library it is required to add
<ol type>to allowed HTML tags if Limit allowed HTML tags and Correct faulty HTML filters are enabled.I am using composer for managing dependencies, and composer-patches library so I didn't have to put the patch inside
/libraries/ckeditor/plugins/liststyle.I just added new patch entry to
composer-patches.jsonfile:Comment #6
b_sharpe commentedPatch above works; however, it should be noted that the
<ul>element is deprecating the "type" attribute in favor of CSS. The<ol>appears to be keeping it.So at some point an alternate solution will need to be found.
Comment #7
bserem commentedPlease see the note here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol
For format with "Limit HTML" it is should be enough to add this in the allowed html tags:<ul list-style-type type> <ol list-style-type type start>@osman you could update the documentation with the above line. I'm in the process of finding a way to automatically apply changes like that on hook_install, my approach is like this:But it is still WIP and doesn't work as expected if the is already some configuration in the tag you are targetting.I am setting this to needs review in the sense that the patch is not needed but a documentation change should solve the issue.
Comment #8
bserem commentedCancel my previous comment, I spoke too fast. CKEditor config allows:
<div class="mystyle--*">but does not allow:
<ul style="list-style-type:*;" type> <ol style="list-style-type:*;" type start>It does allow:
<ul type> <ol type start>however...
Need to research further.
Comment #9
osman