update EditableContent example

This commit is contained in:
rolux 2013-02-27 13:03:55 +05:30
parent e7aca0c595
commit 4c2564ffac

View file

@ -13,23 +13,40 @@ Ox.load('UI', function() {
Ox.loop(1, 4, function(i) { Ox.loop(1, 4, function(i) {
Ox.$('<span>') Ox.$('<span>')
.addClass('label') .addClass('label')
.html((i > 1 ? '&nbsp;' : '') + 'Editable ' + i + ':&nbsp;') .html((i > 1 ? '&nbsp;' : '') + 'SPAN #' + i + ':&nbsp;')
.appendTo($box); .appendTo($box);
Ox.EditableContent({ Ox.EditableContent({
placeholder: 'Placeholder ' + i, editing: i == 1,
placeholder: 'Placeholder',
tooltip: 'Doubleclick to edit' tooltip: 'Doubleclick to edit'
}) })
.bindEvent({
submit: function(data) {
Ox.print(data.value);
}
})
.appendTo($box); .appendTo($box);
}); });
Ox.$('<div>') Ox.$('<div>')
.addClass('label') .addClass('label')
.html('Editable 4:') .html('DIV')
.appendTo($box); .appendTo($box);
Ox.EditableContent({ Ox.EditableContent({
placeholder: 'Placeholder 4', placeholder: 'Placeholder',
tooltip: 'Doubleclick to edit', tooltip: function(e) {
type: 'div' var $target = $(e.target);
return $target.is('a') || $target.parents('a').length
? 'Shift+doubleclick to edit' : 'Doubleclick to edit';
},
type: 'div',
value: 'This is a <a href="http://google.com">link</a>.'
})
.css({width: '512px'})
.bindEvent({
submit: function(data) {
Ox.print(data.value);
}
}) })
.appendTo($box); .appendTo($box);