Merge pull request #335 from alexvandesande/ui

Cut, Copy, Undo and Redo working in webview
This commit is contained in:
Jeffrey Wilcke
2015-02-19 22:36:35 +01:00
4 changed files with 26 additions and 23 deletions

View File

@@ -20,16 +20,18 @@
console.log("loaded?");
document.onkeydown = function(evt) {
// This functions keeps track of keyboard inputs in order to allow copy, paste and other features
evt = evt || window.event;
if (evt.ctrlKey && evt.keyCode == 67) {
window.document.execCommand("copy");
console.log("Ctrl-C");
} else if (evt.ctrlKey && evt.keyCode == 88) {
window.document.execCommand("cut");
console.log("Ctrl-X");
} if (evt.ctrlKey && evt.keyCode == 86) {
console.log("Ctrl-V");
} if (evt.ctrlKey && evt.keyCode == 90) {
console.log("Ctrl-Z");
} else if (evt.ctrlKey && evt.keyCode == 86) {
window.document.execCommand("paste");
} else if (evt.ctrlKey && evt.keyCode == 90) {
window.document.execCommand("undo");
} else if (evt.ctrlKey && evt.shiftKey && evt.keyCode == 90) {
window.document.execCommand("redo");
}
};