fix copy, cut and past in IE
This commit is contained in:
parent
6d098070a4
commit
ddccaa75b2
1 changed files with 23 additions and 4 deletions
|
|
@ -114,7 +114,6 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
|
|
@ -129,7 +128,6 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
|
|
@ -163,8 +161,29 @@ var TextInput = function(parentNode, host) {
|
|||
event.addListener(text, "propertychange", onTextInput);
|
||||
};
|
||||
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
if (useragent.isIE) {
|
||||
event.addListener(text, "beforecopy", function(e) {
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
clipboardData.setData("Text", copyText);
|
||||
else
|
||||
e.preventDefault();
|
||||
});
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 88) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
clipboardData.setData("Text", copyText);
|
||||
host.onCut();
|
||||
}
|
||||
event.preventDefault(e)
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
}
|
||||
|
||||
event.addListener(text, "compositionstart", onCompositionStart);
|
||||
if (useragent.isGecko) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue