diff options
author | Bryce Johnson <bryce@gitlab.com> | 2016-10-05 12:48:18 +0200 |
---|---|---|
committer | Bryce Johnson <bryce@gitlab.com> | 2016-10-05 12:48:18 +0200 |
commit | 2d41c3f5a04ae9879749bb8f0d903c28212f4298 (patch) | |
tree | 1cfc7b237cd7d1ca085a525c1e0fb9b435945641 /app/assets/javascripts/blob | |
parent | b6d52a6f10d5f3d65459a953b53ba1c380fd39af (diff) | |
download | gitlab-ce-2d41c3f5a04ae9879749bb8f0d903c28212f4298.tar.gz |
Restore inexplicably removed code from requestFileSuccess.desplacturing
(also clean up a few global refs)
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r-- | app/assets/javascripts/blob/template_selector.js.es6 | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js.es6 b/app/assets/javascripts/blob/template_selector.js.es6 index ba60b3b2b98..4e309e480b0 100644 --- a/app/assets/javascripts/blob/template_selector.js.es6 +++ b/app/assets/javascripts/blob/template_selector.js.es6 @@ -68,8 +68,15 @@ // To be implemented on the extending class // e.g. // Api.gitignoreText item.name, @requestFileSuccess.bind(@) - requestFileSuccess(file, skipFocus) { - this.editor.setValue(file.content, 1); + requestFileSuccess(file, { skipFocus, append } = {}) { + const oldValue = this.editor.getValue(); + let newValue = file.content; + + if (append && oldValue.length && oldValue !== newValue) { + newValue = oldValue + '\n\n' + newValue; + } + + this.editor.setValue(newValue, 1); if (!skipFocus) this.editor.focus(); if (this.editor instanceof jQuery) { |