diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-06-28 12:11:56 +0530 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-07-02 15:09:37 +0530 |
commit | ffe7c511c2edb4d0a4862aab963de32c05e77fed (patch) | |
tree | b5166c3a8fec5c024cc16b9c0e6a2ddbe0afd926 /app/assets/javascripts | |
parent | 3c0ff4ddb9a910a2da0472cfc6ced745a421a623 (diff) | |
download | gitlab-ce-ffe7c511c2edb4d0a4862aab963de32c05e77fed.tar.gz |
Add `&` support for epics autocompletion
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/gl_form.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/pages/snippets/form.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/shared/milestones/form.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/markdown/field.vue | 1 |
5 files changed, 13 insertions, 2 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 09186a865e4..73b2cd0b2c7 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -12,7 +12,7 @@ export const defaultAutocompleteConfig = { members: true, issues: true, mergeRequests: true, - epics: false, + epics: true, milestones: true, labels: true, }; @@ -493,6 +493,7 @@ GfmAutoComplete.atTypeMap = { '@': 'members', '#': 'issues', '!': 'mergeRequests', + '&': 'epics', '~': 'labels', '%': 'milestones', '/': 'commands', diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index f802971a3ca..c74de7ac34d 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -9,6 +9,13 @@ export default class GLForm { this.form = form; this.textarea = this.form.find('textarea.js-gfm-input'); this.enableGFM = Object.assign({}, GFMConfig.defaultAutocompleteConfig, enableGFM); + // Disable autocomplete for keywords which do not have dataSources available + const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {}; + Object.keys(this.enableGFM).forEach(item => { + if (item !== 'emojis') { + this.enableGFM[item] = !!dataSources[item]; + } + }); // Before we start, we should clean up any previous data for this form this.destroy(); // Setup the form diff --git a/app/assets/javascripts/pages/snippets/form.js b/app/assets/javascripts/pages/snippets/form.js index 758bbafead3..f369c7ef9a6 100644 --- a/app/assets/javascripts/pages/snippets/form.js +++ b/app/assets/javascripts/pages/snippets/form.js @@ -8,6 +8,7 @@ export default () => { members: false, issues: false, mergeRequests: false, + epics: false, milestones: false, labels: false, }); diff --git a/app/assets/javascripts/shared/milestones/form.js b/app/assets/javascripts/shared/milestones/form.js index 060f374310c..8681a1776c6 100644 --- a/app/assets/javascripts/shared/milestones/form.js +++ b/app/assets/javascripts/shared/milestones/form.js @@ -8,10 +8,11 @@ export default (initGFM = true) => { new DueDateSelectors(); // eslint-disable-line no-new // eslint-disable-next-line no-new new GLForm($('.milestone-form'), { - emojis: initGFM, + emojis: true, members: initGFM, issues: initGFM, mergeRequests: initGFM, + epics: initGFM, milestones: initGFM, labels: initGFM, }); diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index fba67681777..298971a36b2 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -67,6 +67,7 @@ members: this.enableAutocomplete, issues: this.enableAutocomplete, mergeRequests: this.enableAutocomplete, + epics: this.enableAutocomplete, milestones: this.enableAutocomplete, labels: this.enableAutocomplete, }); |