Add suggest menu for task ID

This commit is contained in:
Frederic Guillot
2016-12-03 12:56:12 -05:00
parent 4b22db5400
commit 23d862aef8
24 changed files with 382 additions and 36 deletions

File diff suppressed because one or more lines are too long

View File

@@ -139,13 +139,16 @@ KB.component('suggest-menu', function(containerElement, options) {
return null;
}
function fetchItems(trigger, text, value) {
if (typeof value === 'string') {
KB.http.get(value).success(function (response) {
function fetchItems(trigger, text, params) {
if (typeof params === 'string') {
var regex = new RegExp('SEARCH_TERM', 'g');
var url = params.replace(regex, text);
KB.http.get(url).success(function (response) {
onItemFetched(trigger, text, response);
});
} else {
onItemFetched(trigger, text, value);
onItemFetched(trigger, text, params);
}
}

View File

@@ -70,8 +70,8 @@ KB.component('text-editor', function (containerElement, options) {
textarea = textareaElement.build();
if (options.mentionUrl) {
KB.getComponent('suggest-menu', textarea, {triggers: {'@': options.mentionUrl}}).render();
if (options.suggestOptions) {
KB.getComponent('suggest-menu', textarea, options.suggestOptions).render();
}
return KB.dom('div')