From 1246beb4da811e7f86b11a1b0626c076d647fbff Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 26 Sep 2013 21:35:28 +0000 Subject: [PATCH] make collapseToEnd optional --- source/Ox.UI/js/Form/EditableContent.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/Ox.UI/js/Form/EditableContent.js b/source/Ox.UI/js/Form/EditableContent.js index b7dbc462..9036bf9a 100644 --- a/source/Ox.UI/js/Form/EditableContent.js +++ b/source/Ox.UI/js/Form/EditableContent.js @@ -12,6 +12,7 @@ Ox.EditableContent = function(options, self) { var that = Ox.Element(options.type == 'textarea' ? '
' : '', 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;