Last active
December 17, 2015 01:49
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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