diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-01-19 10:02:39 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-01-19 10:02:39 -0600 |
commit | dd6f91cdcc015f554df0fdeb78b30fa6d627d38d (patch) | |
tree | 445d176dfb2f2c1c7bfd486fc68570260ada5dbf /app | |
parent | b6ac53322e8562e65bbed3a4decce2dd057a3d1e (diff) | |
download | gitlab-ce-dd6f91cdcc015f554df0fdeb78b30fa6d627d38d.tar.gz |
Trigger autosize on the textarea after pasting
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js.es6 | 8 | ||||
-rw-r--r-- | app/assets/javascripts/shortcuts_issuable.js | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 24aedcae1ed..92b2ef6e959 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -185,6 +185,14 @@ target.value = newText; target.selectionStart = target.selectionEnd = selectionStart + text.length; + + // Trigger autosave + $(target).trigger('input'); + + // Trigger autosize + var event = document.createEvent('Event'); + event.initEvent('autosize:update', true, false); + target.dispatchEvent(event); }; w.gl.utils.nodeMatchesSelector = (node, selector) => { diff --git a/app/assets/javascripts/shortcuts_issuable.js b/app/assets/javascripts/shortcuts_issuable.js index 6603b9679b9..97fa68c8437 100644 --- a/app/assets/javascripts/shortcuts_issuable.js +++ b/app/assets/javascripts/shortcuts_issuable.js @@ -61,8 +61,15 @@ replyField.val(function(_, current) { return current + separator + quote.join('') + "\n"; }); - // Trigger autosave for the added text + + // Trigger autosave replyField.trigger('input'); + + // Trigger autosize + var event = document.createEvent('Event'); + event.initEvent('autosize:update', true, false); + replyField.get(0).dispatchEvent(event); + // Focus the input field return replyField.focus(); }; |