I've created an MR for this. It's almost there. The only thing missing is the replacement of the existing link text with the new value in the dropdown text field. The CKEditor5 code part is a pain...
@wim-leers I bumped into this when I was writing a plugin to add the Text Transformation feature into CKEditor 5. I've made it (BTW, I've written
a module for that →
), but trying some plugin advanced configs, I noticed some of them needed returning NULL values. For example, the extra
config with regular expressions:
Looking at core/modules/ckeditor5/js/ckeditor5.js
code, I found out that I could return a RegExp as config using a structure like this (on a CKEditor5Plugin
or hook_ckeditor5_plugin_info_alter
implementation):
return [
// ...
'extra' => [
[
'from' => ['regexp' => ['pattern' => '/(^|\s)(")([^"]*)(")$/']],
'to' => [NULL, '«', NULL, '»'],
],
]
];
However, when I did this, the editor got broken, and a JS error on the browser console pointed to an error on ckeditor5.js. Then, looking at processConfig()
's code, it assumes the config parameter is always a valid Object, but in Javascript, typeof null === 'object'
(which is crazy), so when config is null, the error occurs.
My MR just adds a null check for the config parameter.
By mistake, I created this for 10.2.x. I've changed the Version field to 10.3.x, but I don't know how to rebase the issue branch and MR. If someone can help, I'd appreciate it.
Moving to 10.3.x
For those who may be interested, I just created a module that adds the TextTransformation plugin to CKEditor 5.
https://www.drupal.org/project/ckeditor_text_transformation →
Here's an initial patch to fix the issue.
I had to fix another issue on the controller due to a change in Symfony's Request class.
#11 does not include #8 and #9 fixes. Here's a new one.
However, if the block is non-reusable (inline), the result's view/edit links point to an "access denied" page. In this case, it should point to the node containing the block. I'll try to implement this and submit a new patch.