make collapseToEnd optional
This commit is contained in:
parent
6e6da8e000
commit
1246beb4da
1 changed files with 8 additions and 5 deletions
|
@ -12,6 +12,7 @@ Ox.EditableContent = function(options, self) {
|
|||
var that = Ox.Element(options.type == 'textarea' ? '<div>' : '<span>', self)
|
||||
.defaults({
|
||||
clickLink: null,
|
||||
collapseToEnd: true,
|
||||
editable: true,
|
||||
editing: false,
|
||||
format: null,
|
||||
|
@ -212,11 +213,13 @@ Ox.EditableContent = function(options, self) {
|
|||
selection = window.getSelection();
|
||||
that.$element[0].focus();
|
||||
selection.removeAllRanges();
|
||||
range.selectNodeContents(that.$element[0]);
|
||||
selection.addRange(range);
|
||||
setTimeout(function() {
|
||||
selection.collapseToEnd();
|
||||
});
|
||||
if (self.options.collapseToEnd) {
|
||||
range.selectNodeContents(that.$element[0]);
|
||||
selection.addRange(range);
|
||||
setTimeout(function() {
|
||||
selection.collapseToEnd();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return that;
|
||||
|
|
Loading…
Reference in a new issue