From f1c8fb39a7058ef79a1defd27afdedbcd8e1a956 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 27 Feb 2013 09:25:30 +0530 Subject: [PATCH] handle empty Ox.EditableContent value via CSS --- source/Ox.UI/js/Form/EditableContent.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/source/Ox.UI/js/Form/EditableContent.js b/source/Ox.UI/js/Form/EditableContent.js index 3ee49644..304303a0 100644 --- a/source/Ox.UI/js/Form/EditableContent.js +++ b/source/Ox.UI/js/Form/EditableContent.js @@ -53,12 +53,11 @@ Ox.EditableContent = function(options, self) { cancel(); return false; } - /* setTimeout(function() { - Ox.print('TEXT', that.text()) - Ox.print('HTML', that.html()) + that.css({padding: that.text() ? 0 : '0 2px'}); + //Ox.print('TEXT', that.text()) + //Ox.print('HTML', that.html()) }); - */ } } }) @@ -95,7 +94,7 @@ Ox.EditableContent = function(options, self) { if (value) { that.text(value); } else { - that.html(' '); + that.css({padding: '0 2px'}).text(''); } self.options.editing = true; that.gainFocus(); @@ -149,10 +148,6 @@ Ox.EditableContent = function(options, self) { that.loseFocus(); self.options.editing = false; self.options.value = that.text(); - if (self.options.value.charCodeAt(0) == 160) { - // remove nbsp - self.options.value = self.options.value.substr(1); - } that.removeClass('OxEditableContentInput') .attr({contenteditable: false}) .html(formatValue());