update EditableContent and CSS

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

View file

@ -920,7 +920,7 @@ OxEditableContent
-o-user-select: text; -o-user-select: text;
-webkit-user-select: text; -webkit-user-select: text;
} }
.OxEditableContent.OxEditableContentInput { .OxEditableContent.OxEditing {
white-space: pre; white-space: pre;
} }

View file

@ -456,7 +456,7 @@ Forms
border-top-color: $bodyBorder; border-top-color: $bodyBorder;
} }
.$themeClass .OxEditableContent.OxEditableContentInput:focus { .$themeClass .OxEditableContent.OxEditing {
background-image: -moz-linear-gradient(top, $inputGradient); background-image: -moz-linear-gradient(top, $inputGradient);
background-image: -o-linear-gradient(top, $inputGradient); background-image: -o-linear-gradient(top, $inputGradient);
background-image: -webkit-linear-gradient(top, $inputGradient); background-image: -webkit-linear-gradient(top, $inputGradient);

View file

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