diff --git a/source/Ox.UI/js/Form/Editable.js b/source/Ox.UI/js/Form/Editable.js index ee4e8a23..bdb35b8d 100644 --- a/source/Ox.UI/js/Form/Editable.js +++ b/source/Ox.UI/js/Form/Editable.js @@ -93,7 +93,7 @@ Ox.Editable = function(options, self) { self.css = {}; self.$value = Ox.Element(self.options.type == 'input' ? '' : '
') - .addClass('OxValue OxSelectable') + .addClass('OxValue') .html(formatValue()) .appendTo(that); @@ -188,13 +188,9 @@ Ox.Editable = function(options, self) { } function formatInputValue() { - return Ox.decodeHTMLEntities( - self.options.type == 'input' + return self.options.type == 'input' ? self.options.value - : self.options.value.replace(//g, '\n\n') - .replace(/</g, '&lt;') - .replace(/>/g, '&gt;') - ); + : self.options.value.replace(//g, '\n\n'); } function formatTestValue() { @@ -222,6 +218,12 @@ Ox.Editable = function(options, self) { value, self.options.highlight, 'OxHighlight', true ); } + // timeout needed since formatValue is used when assinging self.$value + setTimeout(function() { + self.$value[ + self.options.value === '' ? 'removeClass' : 'addClass' + ]('OxSelectable'); + }) return value; } diff --git a/source/Ox.UI/js/Form/EditableContent.js b/source/Ox.UI/js/Form/EditableContent.js index 0e147d3a..99efeece 100644 --- a/source/Ox.UI/js/Form/EditableContent.js +++ b/source/Ox.UI/js/Form/EditableContent.js @@ -43,7 +43,7 @@ Ox.EditableContent = function(options, self) { !self.options.editing && that.html(formatValue()); } }) - .addClass('OxEditableContent OxSelectable') + .addClass('OxEditableContent') .on({ blur: self.options.submitOnBlur ? submit : blur, click: function(e) { @@ -159,13 +159,9 @@ Ox.EditableContent = function(options, self) { } function formatInputValue() { - return Ox.decodeHTMLEntities( - self.options.type == 'input' + return self.options.type == 'input' ? self.options.value - : self.options.value.replace(//g, '\n\n') - .replace(/</g, '&lt;') - .replace(/>/g, '&gt;') - ); + : self.options.value.replace(//g, '\n\n'); } function formatValue() { @@ -182,6 +178,9 @@ Ox.EditableContent = function(options, self) { value, self.options.highlight, 'OxHighlight', true ); } + that[ + self.options.value === '' ? 'removeClass' : 'addClass' + ]('OxSelectable'); return value; }