diff --git a/source/Ox.UI/js/Form/EditableContent.js b/source/Ox.UI/js/Form/EditableContent.js index 304303a0..e9353ca3 100644 --- a/source/Ox.UI/js/Form/EditableContent.js +++ b/source/Ox.UI/js/Form/EditableContent.js @@ -3,7 +3,11 @@ Ox.EditableContent = function(options, self) { self = self || {}; var that = Ox.Element({ element: options.type == 'div' ? '
' : '', - tooltip: options.tooltip + tooltip: options.tooltip ? function(e) { + return that.hasClass('OxEditableContentInput') ? '' + : Ox.isString(options.tooltip) ? options.tooltip + : options.tooltip(e); + } : null }, self) .defaults({ clickLink: null, @@ -54,9 +58,15 @@ Ox.EditableContent = function(options, self) { return false; } setTimeout(function() { - that.css({padding: that.text() ? 0 : '0 2px'}); + if (self.options.type == '') { + that.css({padding: that.text() ? 0 : '0 2px'}); + } else if (that.html().match(/

<\/div>$/)) { + that.html( + that.html().replace(/

<\/div>$/, '
') + ) + } //Ox.print('TEXT', that.text()) - //Ox.print('HTML', that.html()) + Ox.print('HTML', that.html()); }); } } @@ -94,7 +104,10 @@ Ox.EditableContent = function(options, self) { if (value) { that.text(value); } else { - that.css({padding: '0 2px'}).text(''); + that.text(''); + if (self.options.type == 'span') { + that.css({padding: '0 2px'}); + } } self.options.editing = true; that.gainFocus(); @@ -151,6 +164,9 @@ Ox.EditableContent = function(options, self) { that.removeClass('OxEditableContentInput') .attr({contenteditable: false}) .html(formatValue()); + if (self.options.type == 'span') { + that.css({padding: 0}); + } that.triggerEvent('submit', {value: self.options.value}); } }