improve editable and tooltip
This commit is contained in:
parent
b957106624
commit
e7c36dacc8
2 changed files with 18 additions and 4 deletions
|
@ -89,11 +89,11 @@ Ox.Editable = function(options, self) {
|
|||
} else {
|
||||
self.$input.options({
|
||||
height: height,
|
||||
width: width// + Ox.UI.SCROLLBAR_SIZE
|
||||
width: width
|
||||
});
|
||||
self.$input.find('textarea').css({
|
||||
height: height + 'px',
|
||||
width: width /*+ Ox.UI.SCROLLBAR_SIZE*/ + 'px'
|
||||
width: width + 'px'
|
||||
});
|
||||
}
|
||||
/*
|
||||
|
@ -106,6 +106,7 @@ Ox.Editable = function(options, self) {
|
|||
function edit() {
|
||||
var height, width;
|
||||
if (self.options.editable && !self.options.editing) {
|
||||
self.options.editing = true;
|
||||
self.originalValue = self.options.value;
|
||||
self.minWidth = 8;
|
||||
self.maxWidth = that.parent().width();
|
||||
|
@ -157,7 +158,7 @@ Ox.Editable = function(options, self) {
|
|||
setTimeout(function() {
|
||||
self.$input.focusInput(false);
|
||||
}, 0);
|
||||
self.options.editing = true;
|
||||
that.$tooltip.options({title: ''});
|
||||
that.triggerEvent('edit', {editing: true});
|
||||
}
|
||||
}
|
||||
|
@ -188,16 +189,28 @@ Ox.Editable = function(options, self) {
|
|||
}
|
||||
|
||||
function submit() {
|
||||
self.options.editing = false;
|
||||
self.options.value = Ox.parseHTML(self.$input.value());
|
||||
self.$input.options({value: formatInputValue()}).hide();
|
||||
self.$test.html(formatTestValue());
|
||||
self.$value.html(formatValue()).show();
|
||||
self.options.editing = false;
|
||||
that.$tooltip.options({title: self.options.tooltip});
|
||||
that.triggerEvent('submit', {
|
||||
value: self.options.value
|
||||
});
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'height' || key == 'width') {
|
||||
var css = {};
|
||||
css[key] = value + 'px';
|
||||
Ox.print(key, 'VALUE', value)
|
||||
self.$test && self.$test.css(css);
|
||||
self.$input && self.$input.css(css);
|
||||
self.$input && self.$input.find(self.options.type).css(css);
|
||||
}
|
||||
};
|
||||
|
||||
that.css = function(css) {
|
||||
self.css = css;
|
||||
that.$element.css(css);
|
||||
|
|
|
@ -30,6 +30,7 @@ Ox.Tooltip = function(options, self) {
|
|||
self.setOption = function(key, value) {
|
||||
if (key == 'title') {
|
||||
that.html(value);
|
||||
value === '' && that.detach();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue