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 () {
|
setTimeout(function () {
|
||||||
sendText();
|
sendText();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var onCut = function(e) {
|
var onCut = function(e) {
|
||||||
|
|
@ -129,7 +128,6 @@ var TextInput = function(parentNode, host) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
sendText();
|
sendText();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||||
|
|
@ -163,8 +161,29 @@ var TextInput = function(parentNode, host) {
|
||||||
event.addListener(text, "propertychange", onTextInput);
|
event.addListener(text, "propertychange", onTextInput);
|
||||||
};
|
};
|
||||||
|
|
||||||
event.addListener(text, "copy", onCopy);
|
if (useragent.isIE) {
|
||||||
event.addListener(text, "cut", onCut);
|
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);
|
event.addListener(text, "compositionstart", onCompositionStart);
|
||||||
if (useragent.isGecko) {
|
if (useragent.isGecko) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue