diff --git a/source/UI/js/Form/ArrayEditable.js b/source/UI/js/Form/ArrayEditable.js
index 73ea6614..0e583ae4 100644
--- a/source/UI/js/Form/ArrayEditable.js
+++ b/source/UI/js/Form/ArrayEditable.js
@@ -45,6 +45,7 @@ Ox.ArrayEditable = function(options, self) {
width: 256
})
.options(options || {})
+ .options({tooltip: tooltip})
.update({
highlight: function() {
self.$items.forEach(function($item) {
@@ -85,7 +86,7 @@ Ox.ArrayEditable = function(options, self) {
// make sure the newline does
// not end up in the textarea
setTimeout(function() {
- that.editItem();
+ that.editItem();
}, 0);
},
key_escape: selectNone,
@@ -176,23 +177,6 @@ Ox.ArrayEditable = function(options, self) {
highlight: self.options.highlight,
maxHeight: self.options.maxHeight,
submitOnBlur: self.options.submitOnBlur,
- tooltip: function(e) {
- var $target = $(e.target),
- isLink = $target.is('a') || $target.parents('a').length,
- click = isLink ? 'Shift-click' : 'Click',
- doubleclick = isLink ? 'shift-doubleclick' : 'doubleclick';
- return (
- self.options.tooltipText
- ? self.options.tooltipText(item) + '
'
- : ''
- ) + (
- self.options.editable
- ? Ox._(click + ' to select') + (
- item.editable ? Ox._(', ' + doubleclick + ' to edit') : ''
- )
- : ''
- );
- },
type: self.options.type,
unformat: self.options.unformat,
value: item.value,
@@ -366,6 +350,29 @@ Ox.ArrayEditable = function(options, self) {
}
}
+ function tooltip(e) {
+ var $target = $(e.target),
+ $element = $target.closest('.OxEditableElement'),
+ position = $element.data('position'),
+ item = self.options.items[position],
+ isLink = $target.closest('a').length,
+ click = isLink ? 'Shift-click' : 'Click',
+ doubleclick = isLink ? 'shift-doubleclick' : 'doubleclick';
+ return item === undefined
+ ? ''
+ : (
+ self.options.tooltipText
+ ? self.options.tooltipText(item) + '
'
+ : ''
+ ) + (
+ self.options.editable
+ ? Ox._(click + ' to select') + (
+ item.editable ? Ox._(', ' + doubleclick + ' to edit') : ''
+ )
+ : ''
+ );
+ }
+
var triggerSelectEvent = Ox.debounce(function() {
that.triggerEvent('select', {
id: self.options.selected