Feature #33425 » 33425.patch
| public/javascripts/application.js | ||
|---|---|---|
|
};
|
||
|
const tribute = new Tribute({
|
||
|
trigger: '#',
|
||
|
values: function (text, cb) {
|
||
|
if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
|
||
|
$(element).attr('autocomplete', 'off');
|
||
|
collection: [
|
||
|
{
|
||
|
// issues
|
||
|
trigger: '#',
|
||
|
values: function (text, cb) {
|
||
|
if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
|
||
|
$(element).attr('autocomplete', 'off');
|
||
|
}
|
||
|
remoteSearch(issuesUrl + text, function (issues) {
|
||
|
return cb(issues);
|
||
|
});
|
||
|
},
|
||
|
lookup: 'label',
|
||
|
fillAttr: 'label',
|
||
|
requireLeadingSpace: true,
|
||
|
selectTemplate: function (issue) {
|
||
|
return '#' + issue.original.id;
|
||
|
},
|
||
|
noMatchTemplate: function () {
|
||
|
return '<span style:"visibility: hidden;"></span>';
|
||
|
}
|
||
|
},
|
||
|
// macros
|
||
|
{
|
||
|
trigger: '{{',
|
||
|
values: [
|
||
|
{name: 'collapse', value: '{{collapse\nThis is a block of text that is collapsed by default.\n}}'},
|
||
|
{name: 'child_pages', value: '{{child_pages}}'},
|
||
|
{name: 'include', value: '{{include(WikiPageName)}}'},
|
||
|
{name: 'thumbnail', value: '{{thumbnail(image.png, size=300, title=Thumbnail)}}'},
|
||
|
{name: 'issue', value: '{{issue(123, subject=true, project=true)}}'}
|
||
|
],
|
||
|
lookup: 'name',
|
||
|
fillAttr: 'value',
|
||
|
requireLeadingSpace: true,
|
||
|
selectTemplate: function(item) {
|
||
|
return item.original.value;
|
||
|
},
|
||
|
noMatchTemplate: function () {
|
||
|
return '<span style:"visibility: hidden;"></span>';
|
||
|
}
|
||
|
}
|
||
|
remoteSearch(issuesUrl + text, function (issues) {
|
||
|
return cb(issues);
|
||
|
});
|
||
|
},
|
||
|
lookup: 'label',
|
||
|
fillAttr: 'label',
|
||
|
requireLeadingSpace: true,
|
||
|
selectTemplate: function (issue) {
|
||
|
return '#' + issue.original.id;
|
||
|
},
|
||
|
noMatchTemplate: function () {
|
||
|
return '<span style:"visibility: hidden;"></span>';
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
tribute.attach(element);
|
||