- Issue created by @dylan donkersgoed
- @dylan-donkersgoed opened merge request.
- Status changed to Needs review
over 1 year ago 6:53pm 12 June 2023 - Assigned to alpha2zee
- 🇦🇫Afghanistan alpha2zee
Thank you for looking into the issue to identify its cause and also note possible fixes along with their drawbacks.
htmLawed is functionally TYPE_HTML_RESTRICTOR, and while making it TYPE_TRANSFORM_IRREVERSIBLE will fix this CKEditor issue, I don't know what issues will arise from the change.
I think it is better to open an issue with CKEditor devs to change their code logic.
- 🇦🇫Afghanistan alpha2zee
As noted elsewhere 🐛 TypeError: Argument 1 passed to Drupal\ckeditor5\HTMLRestrictions::__construct() must be of the type array, object given Closed: works as designed , the CKEditor5 issue doesn't occur in D10 but occurs in D9. It seems CKEditor5 devs are trying 🐛 TypeError: Drupal\ckeditor5\HTMLRestrictions::__construct(): Argument #1 ($elements) must be of type array, Drupal\ckeditor5\HTMLRestrictions given Needs work to get a fix for D9. I guess we just have to wait for that. For those who need an immediate fix, perhaps the suggested patch will work well.
- 🇨🇦Canada dylan donkersgoed London, Ontario
This issue does occur in D10. You can see it if you install a fresh D10 site with the standard profile and try to add this filter to the "Full HTML" format you run into the error.
While there are similarities with the linked issue (similar steps to reproduce, the error occurs in the same function) I don't think it's quite the same problem. This is a validation error when saving the format, not a fatal error. It occurs in D10 even though the fix is already applied in D10. And while I'm not 100% sure I don't think it requires other filters of the same type to be enabled.
I'm also not sure it's actually unintended behaviour in core. I'm not too familiar with the internals of core's CKEditor handling but it does kind of make sense to me that a plugin that declares it restricts HTML but then provides no information about what tags it restricts would encounter validation errors.
- 🇦🇫Afghanistan alpha2zee
Thanks for correcting me. I was under the wrong impression, or may be I had tested a D10 version with a fix 🐛 TypeError: Drupal\ckeditor5\HTMLRestrictions::__construct(): Argument #1 ($elements) must be of type array, Drupal\ckeditor5\HTMLRestrictions given Needs work . The issue does occur in current and dev releases of D10. In my opinion, it is still primarily a core/CKEditor issue with handling of filter modules, as discussed elsewhere 🐛 TypeError: Drupal\ckeditor5\HTMLRestrictions::__construct(): Argument #1 ($elements) must be of type array, Drupal\ckeditor5\HTMLRestrictions given Needs work .
I cannot change the module filter type to something other than TYPE_HTML_RESTRICTOR.
As you noted, implementing getHTMLRestrictions in the htmLawed module is difficult because htmLawed has a different filtering customization and may be more complex filtering ability than Drupal/CKEditor (e.g., regex patterns to indicate permissibility of attribute values). Correctly conveying this through getHTMLRestrictions() may not be not possible .
- Status changed to Closed: won't fix
over 1 year ago 9:50pm 12 September 2023 - 🇮🇹Italy frazac
Maybe linked? https://www.drupal.org/project/twig/issues/3413999#comment-15604317 🐛 The current CKEditor 5 build requires the following elements and attributes: Active