textinput fixes for IE
This commit is contained in:
parent
63a6f19386
commit
573f532a07
2 changed files with 15 additions and 12 deletions
|
|
@ -263,13 +263,10 @@ var Editor =function(renderer, session) {
|
||||||
// Safari needs the timeout
|
// Safari needs the timeout
|
||||||
// iOS and Firefox need it called immediately
|
// iOS and Firefox need it called immediately
|
||||||
// to be on the save side we do both
|
// to be on the save side we do both
|
||||||
// except for IE
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
if (!useragent.isIE) {
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
_self.textInput.focus();
|
_self.textInput.focus();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.textInput.focus();
|
this.textInput.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@ var TextInput = function(parentNode, host) {
|
||||||
var pasted = false;
|
var pasted = false;
|
||||||
var tempStyle = '';
|
var tempStyle = '';
|
||||||
|
|
||||||
|
function select() {
|
||||||
|
try {
|
||||||
|
text.select();
|
||||||
|
} catch (e) {}
|
||||||
|
};
|
||||||
|
|
||||||
function sendText(valueToSend) {
|
function sendText(valueToSend) {
|
||||||
if (!copied) {
|
if (!copied) {
|
||||||
var value = valueToSend || text.value;
|
var value = valueToSend || text.value;
|
||||||
|
|
@ -82,7 +88,7 @@ var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
// Safari doesn't fire copy events if no text is selected
|
// Safari doesn't fire copy events if no text is selected
|
||||||
text.value = PLACEHOLDER;
|
text.value = PLACEHOLDER;
|
||||||
text.select();
|
select();
|
||||||
}
|
}
|
||||||
|
|
||||||
var onTextInput = function(e) {
|
var onTextInput = function(e) {
|
||||||
|
|
@ -123,7 +129,7 @@ var TextInput = function(parentNode, host) {
|
||||||
text.value = copyText;
|
text.value = copyText;
|
||||||
else
|
else
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
text.select();
|
select();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
sendText();
|
sendText();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
@ -137,7 +143,7 @@ var TextInput = function(parentNode, host) {
|
||||||
host.onCut();
|
host.onCut();
|
||||||
} else
|
} else
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
text.select();
|
select();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
sendText();
|
sendText();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
@ -216,12 +222,12 @@ var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
event.addListener(text, "focus", function() {
|
event.addListener(text, "focus", function() {
|
||||||
host.onFocus();
|
host.onFocus();
|
||||||
text.select();
|
select();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.focus = function() {
|
this.focus = function() {
|
||||||
host.onFocus();
|
host.onFocus();
|
||||||
text.select();
|
select();
|
||||||
text.focus();
|
text.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue