The paste functionality in Ace is currently handled through events. Is there a way to add a custom key binding for the paste event? I've tried the following with no such luck (see here):
editor.commands.addCommand({
name: "customPaste",
bindKey: {win: "Ctrl-q", mac: "Command-q"},
exec: function(editor) {
console.log("customPaste");
editor.session._emit('paste');
}
});
The key binding is recognized (as indicated by the console output), but it does not appear to be triggering a paste event.
There is no way to do this using normal javascript.
On chrome you can whitelist your site using an extension, and then call document.execCommand("paste", null, null)
here's how cloud9 does that: extension, execCommand