summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/blob
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-09-15 15:06:18 +0000
committerFatih Acet <acetfatih@gmail.com>2016-09-15 15:06:18 +0000
commit247ae1317492ffd36c7a120101ecb242bcdaf93e (patch)
tree6882a6a67665b2a1f866797c42002ff32d54d0b4 /app/assets/javascripts/blob
parent4b6fd0df62a987d9a5f6f0ba3df8a986396901e0 (diff)
parent287663b2b11c052906aefe42354f75718f980568 (diff)
downloadgitlab-ce-247ae1317492ffd36c7a120101ecb242bcdaf93e.tar.gz
Merge branch 'issue-description-scroll-fix' into 'master'
Trigger autosize update after template selection ## What does this MR do? Triggers an autosize update after selecting an issue template. The autosize plugin doesn't react to value changes and therefore doesn't automatically update when the user selects the template. This merge request adds it so that it detects if the editor the template selector is a jQuery object (not Ace editor) & then triggers the autosize event to allow the user to scroll the textarea. ## Screenshots (if relevant) ![resize](/uploads/1ab04b4202309b13f1178e04c0953112/resize.gif) ## What are the relevant issue numbers? Closes #21982 See merge request !6282
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r--app/assets/javascripts/blob/template_selector.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/blob/template_selector.js b/app/assets/javascripts/blob/template_selector.js
index b18b6962382..95352164d76 100644
--- a/app/assets/javascripts/blob/template_selector.js
+++ b/app/assets/javascripts/blob/template_selector.js
@@ -13,6 +13,9 @@
this.buildDropdown();
this.bindEvents();
this.onFilenameUpdate();
+
+ this.autosizeUpdateEvent = document.createEvent('Event');
+ this.autosizeUpdateEvent.initEvent('autosize:update', true, false);
}
TemplateSelector.prototype.buildDropdown = function() {
@@ -72,6 +75,10 @@
TemplateSelector.prototype.requestFileSuccess = function(file, skipFocus) {
this.editor.setValue(file.content, 1);
if (!skipFocus) this.editor.focus();
+
+ if (this.editor instanceof jQuery) {
+ this.editor.get(0).dispatchEvent(this.autosizeUpdateEvent);
+ }
};
TemplateSelector.prototype.startLoadingSpinner = function() {