handle empty Ox.EditableContent value via CSS

This commit is contained in:
rolux 2013-02-27 09:25:30 +05:30
parent feae953311
commit f1c8fb39a7

View file

@ -53,12 +53,11 @@ Ox.EditableContent = function(options, self) {
cancel(); cancel();
return false; return false;
} }
/*
setTimeout(function() { setTimeout(function() {
Ox.print('TEXT', that.text()) that.css({padding: that.text() ? 0 : '0 2px'});
Ox.print('HTML', that.html()) //Ox.print('TEXT', that.text())
//Ox.print('HTML', that.html())
}); });
*/
} }
} }
}) })
@ -95,7 +94,7 @@ Ox.EditableContent = function(options, self) {
if (value) { if (value) {
that.text(value); that.text(value);
} else { } else {
that.html(' '); that.css({padding: '0 2px'}).text('');
} }
self.options.editing = true; self.options.editing = true;
that.gainFocus(); that.gainFocus();
@ -149,10 +148,6 @@ Ox.EditableContent = function(options, self) {
that.loseFocus(); that.loseFocus();
self.options.editing = false; self.options.editing = false;
self.options.value = that.text(); 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') that.removeClass('OxEditableContentInput')
.attr({contenteditable: false}) .attr({contenteditable: false})
.html(formatValue()); .html(formatValue());