fix editing empty values

This commit is contained in:
j 2013-02-25 21:11:39 +00:00
parent 0957500476
commit 0aa4c42ecf

View file

@ -78,10 +78,15 @@ Ox.EditableContent = function(options, self) {
function edit() { function edit() {
if (self.options.editable && !self.editing) { if (self.options.editable && !self.editing) {
var value = formatInputValue();
self.$value self.$value
.text(formatInputValue() || ' ')
.addClass('OxEditableContentInput') .addClass('OxEditableContentInput')
.attr({contenteditable: true}); .attr({contenteditable: true});
if (value) {
self.$value.text(value);
} else {
self.$value.html(' ');
}
self.editing = true; self.editing = true;
that.gainFocus(); that.gainFocus();
setTimeout(updateSelection, 50); setTimeout(updateSelection, 50);