class GlobalAttribute extends CKEditor5PluginDefault
{ /**
* {@inheritdoc}
*/
public function getDynamicPluginConfig(array
$static_plugin_config, EditorInterface
$editor): array
{ // This plugin is only loaded when filter_html is enabled.
assert($editor->
getFilterFormat()->
filters()->
has('filter_html'
));
$filter_html =
$editor->
getFilterFormat()->
filters('filter_html'
);
$restrictions = HTMLRestrictions::
fromFilterPluginInstance($filter_html);
// Determine which tags are allowed by filter_html, excluding the global
// attribute `*` HTML tag, because that's what we're expanding this to right
// now.
$allowed_elements =
$restrictions->
getAllowedElements();
unset($allowed_elements['*'
]);
$allowed_tags =
array_keys($allowed_elements);
// Update the static plugin configuration: generate a `name` regular
// expression to match any of the HTML tags supported by filter_html.
// @see https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html#configuration