In TinyMCE 4 init I want to use the paste_preprocess function to clean up and edit content that is pasted into TinyMCE editor. What I would like to do is have paste_preprocess make an ajax call to a PHP script that does the cleanup / editing. At the moment I'm not really getting it to work. My code at the moment:
paste_preprocess: function(plugin, args) {
$.ajax({
type: 'POST',
url: '/site/ajax/preprocess.php',
data: {content: args.content},
dataType: 'json',
cache: false,
success: function(result){
if(result.success){
text = result.message;
}
}
})
args.content = text;
},
Does anyone know of a method on how to approach this or pointing me into the right direction? Thanks!