Skip to content

Instantly share code, notes, and snippets.

@EpokK
Last active December 17, 2015 01:49
Show Gist options
  • Save EpokK/5530783 to your computer and use it in GitHub Desktop.
Save EpokK/5530783 to your computer and use it in GitHub Desktop.
Utilisation de dataProcessor avec CKEditor 4 pour filtrer en entrees ce que l'utilisateur colle dans l'éditeur.
CKEDITOR.replace('editor1', {
on: {
pluginsLoaded: function(event) {
event.editor.dataProcessor.dataFilter.addRules({
elements: {
a: function(element) {
var attr = element.attributes;
if(attr.href && attr.href.indexOf('#') === -1) {
element.attributes.target = '_blank';
}
},
// remove script
script: function(element) {
return false;
}
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment