I'm currently working with CKEditor 5, and I'm trying to implement a feature where all paragraphs in the editor have a custom attribute "myAttrib" using the setAttributeProperties method on the schema.
schema.setAttributeProperties("myAttrib", { isFormatting: true });
I want to dynamically change the background color of the first <span> within each paragraph based on the value of this custom attribute "myAttrib". the color of the first span should be set to the attribute property value that lies on the paragraph.
I've been exploring CKEditor 5's conversion mechanisms, but it seems alot complex, and I'm having trouble figuring out the best approach.
Any guidance or examples on how to achieve this using CKEditor 5 would be greatly appreciated.
Additional information:
- It is a requirement that the paragraph hold the custom attribute.
I searched through CKEditor 5's plugin source code and explored the conversion system, focusing on downcast and upcast methods. Despite my efforts, I couldn't find examples addressing my specific goal: dynamically changing the style of the first <span> in each paragraph based on a custom attribute. Existing examples didn't provide a clear solution, and my attempts with downcast and upcast functions were unsuccessful. I'm seeking guidance or examples that specifically tackle this scenario.