ckeditor5-react icon indicating copy to clipboard operation
ckeditor5-react copied to clipboard

Ability to add attributes to the root div

Open danyonedwards opened this issue 2 years ago • 1 comments

It would be awesome if we could pass through attributes that get applied directly to the root div element here

We have a use case where we want to apply data-testid to this div. We were applying it with the CKEditor ref after it had been setup. Due to how CKEditor resets attributes on focus & blur, these custom attributes, were being removed.

Is it possible to add in something like this to fix the issue? This is a loose implementation for our use-case and you may want to do some filtering on the provided props.

danyonedwards avatar Aug 02 '22 03:08 danyonedwards

The tricky case here is not to introduce an XSS vector attack. So, we should avoid copying each attribute. Instead, we could apply [class], [id] and [data-*]. Perhaps even more, but it requires research.

pomek avatar Aug 02 '22 06:08 pomek