forked from 0x2620/oxjs
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)
|
var that = Ox.Element(options.type == 'textarea' ? '<div>' : '<span>', self)
|
||||||
.defaults({
|
.defaults({
|
||||||
clickLink: null,
|
clickLink: null,
|
||||||
|
collapseToEnd: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
editing: false,
|
editing: false,
|
||||||
format: null,
|
format: null,
|
||||||
|
|
@ -212,11 +213,13 @@ Ox.EditableContent = function(options, self) {
|
||||||
selection = window.getSelection();
|
selection = window.getSelection();
|
||||||
that.$element[0].focus();
|
that.$element[0].focus();
|
||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
range.selectNodeContents(that.$element[0]);
|
if (self.options.collapseToEnd) {
|
||||||
selection.addRange(range);
|
range.selectNodeContents(that.$element[0]);
|
||||||
setTimeout(function() {
|
selection.addRange(range);
|
||||||
selection.collapseToEnd();
|
setTimeout(function() {
|
||||||
});
|
selection.collapseToEnd();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue