Commit ed81fb4c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'gfm-source-once' into 'master'

Loads GFM once for per page

## What does this MR do?

Currently the GFM init code is included every time there is a GFM form on the page. This changes that & only includes in once if any number of GFM forms are on the page.

## What are the relevant issue numbers?

#22827

See merge request !6840
parents 9690f614 270434f7
...@@ -119,6 +119,7 @@ v 8.13.0 (unreleased) ...@@ -119,6 +119,7 @@ v 8.13.0 (unreleased)
v 8.12.7 v 8.12.7
- Use gitlab-markup gem instead of github-markup to fix `.rst` file rendering. !6659 - Use gitlab-markup gem instead of github-markup to fix `.rst` file rendering. !6659
- Fix GFM autocomplete setup being called several times
v 8.12.6 v 8.12.6
- Update mailroom to 0.8.1 in Gemfile.lock !6814 - Update mailroom to 0.8.1 in Gemfile.lock !6814
......
...@@ -11,3 +11,4 @@ ...@@ -11,3 +11,4 @@
= render 'layouts/page', sidebar: sidebar, nav: nav = render 'layouts/page', sidebar: sidebar, nav: nav
= yield :scripts_body = yield :scripts_body
= render "layouts/init_auto_complete" if @gfm_form
- @gfm_form = true
- supports_slash_commands = local_assigns.fetch(:supports_slash_commands, false) - supports_slash_commands = local_assigns.fetch(:supports_slash_commands, false)
.zen-backdrop .zen-backdrop
- classes << ' js-gfm-input js-autosize markdown-area' - classes << ' js-gfm-input js-autosize markdown-area'
...@@ -7,6 +8,3 @@ ...@@ -7,6 +8,3 @@
= text_area_tag attr, nil, class: classes, placeholder: placeholder = text_area_tag attr, nil, class: classes, placeholder: placeholder
%a.zen-control.zen-control-leave.js-zen-leave{ href: "#" } %a.zen-control.zen-control-leave.js-zen-leave{ href: "#" }
= icon('compress') = icon('compress')
- content_for :scripts_body do
= render "layouts/init_auto_complete" if current_user && (@target_project || @project)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment