33425-v2.patch

Mizuki ISHIKAWA, 2020-06-10 07:50

Download (1.85 KB)

View differences:

public/javascripts/application.js
1023 1023
    });
1024 1024
});
1025 1025

  
1026
function inlineAutoComplete(element) {
1026
function inlineAutoCompleteIssueId(element) {
1027 1027
    'use strict';
1028 1028
    // do not attach if Tribute is already initialized
1029 1029
    if (element.dataset.tribute === 'true') {return;}
......
1072 1072
    tribute.attach(element);
1073 1073
}
1074 1074

  
1075
function inlineAutoCompleteWikiSyntax(element) {
1076
  const tribute = new Tribute({
1077
    trigger: '{{',
1078
    values: [
1079
      {name: 'collapse', value: '{{collapse\nThis is a block of text that is collapsed by default.\n}}'},
1080
      {name: 'child_pages', value: '{{child_pages}}'},
1081
      {name: 'include', value: '{{include(WikiPageName)}}'},
1082
      {name: 'thumbnail', value: '{{thumbnail(image.png, size=300, title=Thumbnail)}}'},
1083
      {name: 'issue', value: '{{issue(123, subject=true, project=true)}}'}
1084
    ],
1085
    lookup: 'name',
1086
    fillAttr: 'value',
1087
    requireLeadingSpace: true,
1088
    selectTemplate: function(item) {
1089
      return item.original.value;
1090
    },
1091
    noMatchTemplate: function () {
1092
      return '<span style:"visibility: hidden;"></span>';
1093
    }
1094
  });
1095
  tribute.attach(element);
1096
}
1097

  
1075 1098

  
1076 1099
$(document).ready(setupAjaxIndicator);
1077 1100
$(document).ready(hideOnLoad);
......
1081 1104
$(document).ready(setupTabs);
1082 1105
$(document).ready(setupFilePreviewNavigation);
1083 1106
$(document).on('focus', '[data-auto-complete=true]', function(event) {
1084
  inlineAutoComplete(event.target);
1107
  inlineAutoCompleteIssueId(event.target);
1108
});
1109
$(document).on('focus', '.jstEditor [data-auto-complete=true]', function(event) {
1110
  inlineAutoCompleteWikiSyntax(event.target);
1085 1111
});