I need a solution that allows me to add/edit/remove data-* attributes on individual elements in CKEditor without manually adding it directly in the source editors?
I haven't found any config items or plugins that allow me to do this.
How do I go about doing this?
Here is a working sample based on the example you provided.
You can add/edit/remove data attributes on elements with this:
element.data( 'extra-info', 'test' ); // Appended the attribute data-extra-info="test" to the element.
alert( element.data( 'extra-info' ) ); // 'test'
element.data( 'extra-info', false ); // Remove the data-extra-info attribute from the element.
http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With