diff --git a/pandora/config.padma.jsonc b/pandora/config.padma.jsonc index 714651fce..046b513e3 100644 --- a/pandora/config.padma.jsonc +++ b/pandora/config.padma.jsonc @@ -603,6 +603,7 @@ "title": "Keywords", "canAddAnnotations": {"member": true, "staff": true, "admin": true}, "item": "Keyword", + "autocomplete": true, "overlap": true, "type": "string" }, diff --git a/static/js/editor.js b/static/js/editor.js index d1bc77fd6..233d32e71 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -3,7 +3,6 @@ 'use strict'; pandora.ui.editor = function(data) { - var ui = pandora.user.ui, that = Ox.VideoAnnotationPanel({ @@ -15,16 +14,6 @@ pandora.ui.editor = function(data) { annotationsTooltip: Ox._('annotations') + ' ' + Ox.SYMBOLS.shift + 'A', audioTrack: data.audioTrack, - autocomplete: function(key, value, callback) { - pandora.api.autocompleteEntities({ - key: key, - operator: '=', - range: [0, 20], - value: value - }, function(result) { - callback(result.data.items); - }) - }, censored: data.censored, censoredIcon: pandora.site.cantPlay.icon, censoredTooltip: Ox._(pandora.site.cantPlay.text), @@ -53,7 +42,29 @@ pandora.ui.editor = function(data) { layers: data.annotations.map(function(layer) { return Ox.extend({ editable: layer.canAddAnnotations[pandora.user.level] - }, layer); + }, layer, { + autocomplete: layer.type == 'entity' + ? function(key, value, callback) { + pandora.api.autocompleteEntities({ + key: key, + operator: '=', + range: [0, 20], + value: value + }, function(result) { + callback(result.data.items); + }) + } : layer.autocomplete + ? function(key, value, callback) { + pandora.api.autocomplete({ + key: key, + operator: '=', + range: [0, 20], + value: value + }, function(result) { + callback(result.data.items); + }); + } : null + }); }), loop: ui.videoLoop, muted: ui.videoMuted,