fix formatting of editables that span multiple lines

This commit is contained in:
rlx 2012-01-15 21:08:06 +05:30
parent 688ae65cf1
commit d156ede914

View file

@ -122,12 +122,12 @@ Ox.Editable = function(options, self) {
if (self.options.editable && !self.options.editing) {
self.options.editing = true;
self.originalValue = self.options.value;
self.minWidth = 8;
self.maxWidth = that.parent().width();
self.minHeight = 14;
self.maxHeight = that.parent().height();
height = self.options.height || self.$value.height();
/*
height = self.options.type == 'input'
? self.minHeight : self.options.height || self.$value.height();
width = self.options.width || self.$value.width();
*/
self.$value.hide();
Ox.Log('Form', 'H:::', self.options.height, height)
if (!self.$test) {
@ -155,6 +155,12 @@ Ox.Editable = function(options, self) {
});
self.$input.find('input').css(self.css);
}
self.minWidth = 8;
self.maxWidth = that.parent().width();
self.minHeight = 13;
self.maxHeight = self.options.type == 'input' ? self.minHeight : that.parent().height();
height = self.options.height || Ox.limit(self.$test.height(), self.minHeight, self.maxHeight);
width = self.options.width || Ox.limit(self.$test.width(), self.minWidth, self.maxWidth);
self.$input.options({
width: width,
height: height
@ -193,7 +199,7 @@ Ox.Editable = function(options, self) {
function formatTestValue() {
return self.options.type == 'input'
? self.options.value.replace(/ /g, ' ')
? Ox.encodeHTML(self.options.value) //.replace(/ /g, ' ')
: Ox.encodeHTML(self.options.value || ' ')
.replace(/\n$/, '\n ')
.replace(/\n/g, '<br/>')