From d156ede9147dc781559111eb6e022f5a3d538b5a Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 15 Jan 2012 21:08:06 +0530 Subject: [PATCH] fix formatting of editables that span multiple lines --- source/Ox.UI/js/Form/Ox.Editable.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.Editable.js b/source/Ox.UI/js/Form/Ox.Editable.js index 923b8601..9168b1a0 100644 --- a/source/Ox.UI/js/Form/Ox.Editable.js +++ b/source/Ox.UI/js/Form/Ox.Editable.js @@ -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, '
')