Merge pull request #153 from sourcelair/fix/pasting

Fix Ctrl+Shift+V pasting
This commit is contained in:
Paris Kasidiaris
2016-06-30 14:29:28 +03:00
committed by GitHub
+7 -5
View File
@@ -551,8 +551,8 @@
/** /**
* Hack pasting with keyboard, in order to make it work without contentEditable. * Hack pasting with keyboard, in order to make it work without contentEditable.
* When a user types Ctrl + Shift + V or Cmd + V on a Mac, lease the contentEditable value * When a user types Ctrl + Shift + V or Shift + Insert on a non Mac or Cmd + V on a Mac,
* as true. * lease the contentEditable value as true.
*/ */
on(term.element, 'keydown', function (ev) { on(term.element, 'keydown', function (ev) {
var isEditable = term.element.contentEditable === "true"; var isEditable = term.element.contentEditable === "true";
@@ -565,9 +565,11 @@
term.leaseContentEditable(5000); term.leaseContentEditable(5000);
} }
if (!term.isMac && ev.keyCode == 45 && ev.shiftKey && !ev.ctrlKey && !isEditable) { if (!term.isMac && !isEditable) {
// Shift + Insert pastes on windows and many linuxes if ((ev.keyCode == 45 && ev.shiftKey && !ev.ctrlKey) || // Shift + Insert
term.leaseContentEditable(); (ev.keyCode == 86 && ev.shiftKey && ev.ctrlKey)) { // Ctrl + Shict + V
term.leaseContentEditable();
}
} }
}); });