1
0
Fork 0
forked from 0x2620/oxjs

update EditableContent and CSS

This commit is contained in:
rolux 2013-02-28 10:33:20 +05:30
commit c630818553
3 changed files with 7 additions and 11 deletions

View file

@ -4,7 +4,7 @@ Ox.EditableContent = function(options, self) {
if (options.tooltip) {
self.tooltip = options.tooltip;
options.tooltip = function(e) {
return that.hasClass('OxEditableContentInput') ? ''
return that.hasClass('OxEditing') ? ''
: Ox.isString(self.tooltip) ? self.tooltip
: self.tooltip(e);
}
@ -90,11 +90,7 @@ Ox.EditableContent = function(options, self) {
}
})
.bindEvent({
doubleclick: edit,
key_escape: function() {
cancel();
return false;
}
doubleclick: edit
});
self.options.value = self.options.value.toString();
@ -118,7 +114,7 @@ Ox.EditableContent = function(options, self) {
if (self.options.editing) {
that.loseFocus();
self.options.editing = false;
that.removeClass('OxEditableContentInput')
that.removeClass('OxEditing')
.attr({contenteditable: false})
.html(formatValue());
if (self.options.type == 'input') {
@ -132,7 +128,7 @@ Ox.EditableContent = function(options, self) {
if (self.options.editable && !self.options.editing) {
var value = formatInputValue();
that.$tooltip && that.$tooltip.remove();
that.addClass('OxEditableContentInput')
that.addClass('OxEditing')
.removeClass('OxPlaceholder')
.attr({contenteditable: true});
if (value) {
@ -193,7 +189,7 @@ Ox.EditableContent = function(options, self) {
that.loseFocus();
self.options.editing = false;
self.options.value = parseValue();
that.removeClass('OxEditableContentInput')
that.removeClass('OxEditing')
.attr({contenteditable: false})
.html(formatValue());
if (self.options.type == 'input') {