keep cursor if not collapseToEnd

This commit is contained in:
j 2013-09-30 09:40:47 +00:00
parent a9a804887a
commit 961a3c0850

View file

@ -213,15 +213,15 @@ Ox.EditableContent = function(options, self) {
var range = document.createRange(), var range = document.createRange(),
selection = window.getSelection(); selection = window.getSelection();
that.$element[0].focus(); that.$element[0].focus();
selection.removeAllRanges();
if (self.options.collapseToEnd) { if (self.options.collapseToEnd) {
selection.removeAllRanges();
range.selectNodeContents(that.$element[0]); range.selectNodeContents(that.$element[0]);
selection.addRange(range); selection.addRange(range);
}
setTimeout(function() { setTimeout(function() {
selection.collapseToEnd(); selection.collapseToEnd();
}); });
} }
}
return that; return that;