Project

General

Profile

Feature #33425 » 33425-v2.patch

Mizuki ISHIKAWA, 2020-06-10 07:50

View differences:

public/javascripts/application.js
});
});
function inlineAutoComplete(element) {
function inlineAutoCompleteIssueId(element) {
'use strict';
// do not attach if Tribute is already initialized
if (element.dataset.tribute === 'true') {return;}
......
tribute.attach(element);
}
function inlineAutoCompleteWikiSyntax(element) {
const tribute = new Tribute({
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>';
}
});
tribute.attach(element);
}
$(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad);
......
$(document).ready(setupTabs);
$(document).ready(setupFilePreviewNavigation);
$(document).on('focus', '[data-auto-complete=true]', function(event) {
inlineAutoComplete(event.target);
inlineAutoCompleteIssueId(event.target);
});
$(document).on('focus', '.jstEditor [data-auto-complete=true]', function(event) {
inlineAutoCompleteWikiSyntax(event.target);
});
(3-3/5)