I am trying to figure out a way to remove style properties from pasted HTML content into a CKEditor instance. I used the following to remove style attributes completely, but I actually want to keep the margin-left property.
CKEDITOR.on('instanceReady', function(ev) {
ev.editor.on('paste', function(evt) {
if (evt.data.type == 'html') {
evt.data.dataValue = evt.data.dataValue.replace(/ style=".*?"/g, '');
}
}, null, null, 9);
});
The issue is, sometimes margin-left is just switched to the margin shorthand and extra data that I do not want is added to that.
I am looking into jQuery and Javascript methods to try and accomplish this, but I haven't had any success yet.