diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 12:06:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 12:06:04 +0300 |
commit | bc89882970d6a14b1f72eb9c715fae90b26d066c (patch) | |
tree | f5cb59d5130d7585980eb39437071e07ebc12f87 /app/assets/javascripts/behaviors | |
parent | 4a45a787703cb78c6101750cfbdc9f656b934b42 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/behaviors')
-rw-r--r-- | app/assets/javascripts/behaviors/preview_markdown.js | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js index 1909830e9ed..a07942d87cb 100644 --- a/app/assets/javascripts/behaviors/preview_markdown.js +++ b/app/assets/javascripts/behaviors/preview_markdown.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, prefer-arrow-callback */ +/* eslint-disable func-names, no-var */ import $ from 'jquery'; import axios from '~/lib/utils/axios_utils'; @@ -45,26 +45,22 @@ MarkdownPreview.prototype.showPreview = function($form) { this.hideReferencedUsers($form); } else { preview.addClass('md-preview-loading').text(__('Loading...')); - this.fetchMarkdownPreview( - mdText, - url, - function(response) { - var body; - if (response.body.length > 0) { - ({ body } = response); - } else { - body = this.emptyMessage; - } - - preview.removeClass('md-preview-loading').html(body); - preview.renderGFM(); - this.renderReferencedUsers(response.references.users, $form); - - if (response.references.commands) { - this.renderReferencedCommands(response.references.commands, $form); - } - }.bind(this), - ); + this.fetchMarkdownPreview(mdText, url, response => { + var body; + if (response.body.length > 0) { + ({ body } = response); + } else { + body = this.emptyMessage; + } + + preview.removeClass('md-preview-loading').html(body); + preview.renderGFM(); + this.renderReferencedUsers(response.references.users, $form); + + if (response.references.commands) { + this.renderReferencedCommands(response.references.commands, $form); + } + }); } }; @@ -132,12 +128,12 @@ const markdownToolbar = $('.md-header-toolbar'); $.fn.setupMarkdownPreview = function() { var $form = $(this); - $form.find('textarea.markdown-area').on('input', function() { + $form.find('textarea.markdown-area').on('input', () => { markdownPreview.hideReferencedUsers($form); }); }; -$(document).on('markdown-preview:show', function(e, $form) { +$(document).on('markdown-preview:show', (e, $form) => { if (!$form) { return; } @@ -162,7 +158,7 @@ $(document).on('markdown-preview:show', function(e, $form) { markdownPreview.showPreview($form); }); -$(document).on('markdown-preview:hide', function(e, $form) { +$(document).on('markdown-preview:hide', (e, $form) => { if (!$form) { return; } @@ -191,7 +187,7 @@ $(document).on('markdown-preview:hide', function(e, $form) { markdownPreview.hideReferencedCommands($form); }); -$(document).on('markdown-preview:toggle', function(e, keyboardEvent) { +$(document).on('markdown-preview:toggle', (e, keyboardEvent) => { var $target; $target = $(keyboardEvent.target); if ($target.is('textarea.markdown-area')) { |