allow for autocomplete in annotations of type entity (first pass)

This commit is contained in:
rolux 2014-12-16 13:02:18 +00:00
commit d6a1dae8b8
5 changed files with 31 additions and 3 deletions

View file

@ -265,7 +265,7 @@ Ox.AnnotationFolder = function(options, self) {
.appendTo(self.$outer);
}
self.$annotations = Ox.ArrayEditable({
self.$annotations = Ox.ArrayEditable(Ox.extend({
clickLink: self.options.clickLink,
editable: self.options.editable,
getSortValue: self.options.type == 'text'
@ -286,7 +286,16 @@ Ox.AnnotationFolder = function(options, self) {
width: self.options.width,
maxHeight: self.options.type == 'text' ? Infinity : void 0,
type: self.options.type == 'text' ? 'textarea' : 'input'
})
}, self.options.type == 'entity' ? {
autocomplete: function(value, callback) {
self.options.autocomplete(self.options.id, value, callback);
},
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
autocompleteSelect: true,
autocompleteSelectHighlight: true,
autocompleteSelectMaxWidth: 256
} : {}))
.bindEvent({
add: function(data) {
if (self.editing) {