Allow manual resize of js-autosize textareas
First, the autosize library was being too controlling and removed the
`resize` property from any elements to which it was attached, removing
the drag handle. We've disabled this behavior in the vendored library
and added a spec to prevent a regression during an upgrade.
Second, we detect (as best we can) when the user manually resizes an
autosize textarea, and then remove the autosize behavior from it and
increase its max-height.
This should allow for the best of both worlds.
Closes#12832
See merge request !2653
- No longer depends on the "hidden checkbox".
- No longer depends on manually storing/restoring the scroll position.
Instead, we take advantage of jquery.scrollTo.
- Event-based.
- Simplifies the state-based styling.
Prior, any of the specified IDs could have been hijacked by a table of
contents header, breaking the tab functionality. For example, a `##
Notes` header would get the id `notes` and prevent the Discussion tab
from being activated.
Closes#3908
Also makes it work when given a parent element containing a
`.js-syntax-highlight` element so for dynamically-added things like
notes or Markdown previews, we can more accurately target just the
element we care about.
On the first load, the merge request tabs would be requested in JSON format to render
the HTML. This would cause the "Reload with full diff" button to create a link to diff.json.
Closes#2041
MergeRequest#show performance improvements
This is a first pass on improving the performance of the `MergeRequests#show` page. Notable changes:
- The "Commits" tab is loaded lazily, so the initial page load should be much faster for MRs with many commits.
- Relative timestamps via `timeago` are only initialized once per load instead of `O(n^2)`. This greatly improves frontend rendering times for a large number of commits.
- Refactored `User.find_for_commit` to use a single ARel-generated SQL query instead of the old method which resulted in one query, and could result in up to three.
See merge request !838