When setting the width of a cell with the "cell properties" icon this is added as ex. style="width: 20%" to the html of the td tag.
The core Filter module calls the filterXss() method of the \Drupal\editor\EditorXssFilter\Standard class.
https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/edit...
This method filters out style as a dangerous tag
$dangerous_tags = ['script', 'style', 'link', 'embed', 'object'];
So the style attribute is always removed when the "Limit allowed HTML tags" option is enabled even if you allow <td style> in it.
The only option seems to disable "Limit allowed HTML tags" or use classes and a long workaround like in https://www.drupal.org/project/colorbutton/issues/2910028.
Comments
Comment #2
hansrossel commentedComment #3
a.milkovskyThank you for reporting this. Maybe there is a way to change the functionality from style="width:20%" to width="20%".
Comment #4
hansrossel commentedComment #5
hansrossel commentedThe width attribute has been deprecated since HTML4 https://www.w3.org/TR/html401/struct/tables.html#edef-TH, so although it still works at this moment it could suddenly stop working in the future.
Comment #6
a.milkovskyAlright. Then maybe https://www.w3.org/TR/html401/struct/tables.html#edef-COL is the right way.