Jsfiddle example here:
http://jsfiddle.net/w0ap9Lun/1/
My goal is to select all the content of the TinyMCE textarea and copy it to the clip board (the equivalent of highlighting it all and pressing ctrl+c).
I can do this with a normal input like so:
$('.copyToclip').on('click', function() {
//select the input
$(this).siblings('input').select();
//fire the copy command
document.execCommand("copy");
$(this).text('copied');
});
The following code selects everything in the editor but when i call 'execCommand("copy")' it is not copied to the clip board, here is my code:
$('.copyTinyMCEToclip').on('click', function() {
//select the content of the active tinyMCE instance
tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.getBody());
document.execCommand("copy");
$(this).text('copied');
});
Any help would be greatly appreciated.