client/tags: mark used tags in autocomplete
This commit is contained in:
parent
81afd383fa
commit
dbf44ed58f
3 changed files with 10 additions and 2 deletions
|
@ -325,3 +325,5 @@ input[type=file]:focus+.file-dropper,
|
||||||
color: $button-enabled-text-color
|
color: $button-enabled-text-color
|
||||||
span
|
span
|
||||||
color: $button-enabled-text-color
|
color: $button-enabled-text-color
|
||||||
|
.disabled
|
||||||
|
color: $inactive-link-color
|
||||||
|
|
|
@ -10,7 +10,9 @@ class TagAutoCompleteControl extends AutoCompleteControl {
|
||||||
const caseSensitive = false;
|
const caseSensitive = false;
|
||||||
const minLengthForPartialSearch = 3;
|
const minLengthForPartialSearch = 3;
|
||||||
|
|
||||||
options = Object.assign({}, options);
|
options = Object.assign({
|
||||||
|
isTaggedWith: tag => false,
|
||||||
|
}, options);
|
||||||
|
|
||||||
options.getMatches = text => {
|
options.getMatches = text => {
|
||||||
const transform = caseSensitive ?
|
const transform = caseSensitive ?
|
||||||
|
@ -30,7 +32,10 @@ class TagAutoCompleteControl extends AutoCompleteControl {
|
||||||
tags.getOriginalTagName(kv[0]));
|
tags.getOriginalTagName(kv[0]));
|
||||||
const category = kv[1].category;
|
const category = kv[1].category;
|
||||||
const usages = kv[1].usages;
|
const usages = kv[1].usages;
|
||||||
const cssName = misc.makeCssName(category, 'tag');
|
let cssName = misc.makeCssName(category, 'tag');
|
||||||
|
if (options.isTaggedWith(kv[0])) {
|
||||||
|
cssName += ' disabled';
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
caption: misc.unindent`
|
caption: misc.unindent`
|
||||||
<span class="${cssName}">
|
<span class="${cssName}">
|
||||||
|
|
|
@ -56,6 +56,7 @@ class TagInputControl extends events.EventTarget {
|
||||||
this.addTag(text, SOURCE_USER_INPUT);
|
this.addTag(text, SOURCE_USER_INPUT);
|
||||||
},
|
},
|
||||||
verticalShift: -2,
|
verticalShift: -2,
|
||||||
|
isTaggedWith: tagName => this.isTaggedWith(tagName),
|
||||||
});
|
});
|
||||||
this._tagInputNode.addEventListener(
|
this._tagInputNode.addEventListener(
|
||||||
'keydown', e => this._evtInputKeyDown(e));
|
'keydown', e => this._evtInputKeyDown(e));
|
||||||
|
|
Loading…
Reference in a new issue