summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/behaviors
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/behaviors')
-rw-r--r--app/assets/javascripts/behaviors/autosize.js2
-rw-r--r--app/assets/javascripts/behaviors/bind_in_out.js2
-rw-r--r--app/assets/javascripts/behaviors/copy_to_clipboard.js2
-rw-r--r--app/assets/javascripts/behaviors/gl_emoji.js2
-rw-r--r--app/assets/javascripts/behaviors/load_startup_css.js2
-rw-r--r--app/assets/javascripts/behaviors/markdown/copy_as_gfm.js12
-rw-r--r--app/assets/javascripts/behaviors/markdown/highlight_current_user.js2
-rw-r--r--app/assets/javascripts/behaviors/markdown/marks/inline_diff.js2
-rw-r--r--app/assets/javascripts/behaviors/markdown/marks/inline_html.js6
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/code_block.js6
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/emoji.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/image.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/playable.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/reference.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/table_cell.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js2
-rw-r--r--app/assets/javascripts/behaviors/markdown/paste_markdown_table.js13
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_math.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_mermaid.js8
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_metrics.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/schema.js4
-rw-r--r--app/assets/javascripts/behaviors/markdown/serializer.js4
-rw-r--r--app/assets/javascripts/behaviors/preview_markdown.js40
-rw-r--r--app/assets/javascripts/behaviors/quick_submit.js2
-rw-r--r--app/assets/javascripts/behaviors/requires_input.js2
-rw-r--r--app/assets/javascripts/behaviors/secret_values.js4
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/keybindings.js8
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/shortcuts.js8
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js2
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js4
30 files changed, 77 insertions, 90 deletions
diff --git a/app/assets/javascripts/behaviors/autosize.js b/app/assets/javascripts/behaviors/autosize.js
index 3e9d77cdf6b..a5404539c17 100644
--- a/app/assets/javascripts/behaviors/autosize.js
+++ b/app/assets/javascripts/behaviors/autosize.js
@@ -8,6 +8,6 @@ document.addEventListener('DOMContentLoaded', () => {
Autosize(autosizeEls);
Autosize.update(autosizeEls);
- autosizeEls.forEach(el => el.classList.add('js-autosize-initialized'));
+ autosizeEls.forEach((el) => el.classList.add('js-autosize-initialized'));
});
});
diff --git a/app/assets/javascripts/behaviors/bind_in_out.js b/app/assets/javascripts/behaviors/bind_in_out.js
index 886f127b06b..2c5a3994ade 100644
--- a/app/assets/javascripts/behaviors/bind_in_out.js
+++ b/app/assets/javascripts/behaviors/bind_in_out.js
@@ -30,7 +30,7 @@ class BindInOut {
static initAll() {
const ins = document.querySelectorAll('*[data-bind-in]');
- return [].map.call(ins, anIn => BindInOut.init(anIn));
+ return [].map.call(ins, (anIn) => BindInOut.init(anIn));
}
static init(anIn, anOut) {
diff --git a/app/assets/javascripts/behaviors/copy_to_clipboard.js b/app/assets/javascripts/behaviors/copy_to_clipboard.js
index e822072d669..1176fa6628d 100644
--- a/app/assets/javascripts/behaviors/copy_to_clipboard.js
+++ b/app/assets/javascripts/behaviors/copy_to_clipboard.js
@@ -58,7 +58,7 @@ export default function initCopyToClipboard() {
* the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy
* data types to the intended values.
*/
- $(document).on('copy', 'body > textarea[readonly]', e => {
+ $(document).on('copy', 'body > textarea[readonly]', (e) => {
const { clipboardData } = e.originalEvent;
if (!clipboardData) return;
diff --git a/app/assets/javascripts/behaviors/gl_emoji.js b/app/assets/javascripts/behaviors/gl_emoji.js
index 16373b523b2..1fa37999d62 100644
--- a/app/assets/javascripts/behaviors/gl_emoji.js
+++ b/app/assets/javascripts/behaviors/gl_emoji.js
@@ -32,7 +32,7 @@ class GlEmoji extends HTMLElement {
const isEmojiUnicode =
this.childNodes &&
- Array.prototype.every.call(this.childNodes, childNode => childNode.nodeType === 3);
+ Array.prototype.every.call(this.childNodes, (childNode) => childNode.nodeType === 3);
if (
emojiUnicode &&
diff --git a/app/assets/javascripts/behaviors/load_startup_css.js b/app/assets/javascripts/behaviors/load_startup_css.js
index 1d7bf716475..dbe9ff8b6e7 100644
--- a/app/assets/javascripts/behaviors/load_startup_css.js
+++ b/app/assets/javascripts/behaviors/load_startup_css.js
@@ -8,7 +8,7 @@ export const loadStartupCSS = () => {
() => {
document
.querySelectorAll('link[media=print]')
- .forEach(x => x.dispatchEvent(new Event('load')));
+ .forEach((x) => x.dispatchEvent(new Event('load')));
},
{ once: true },
);
diff --git a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
index ce5b63df19c..9a8af79210e 100644
--- a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
+++ b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
@@ -10,10 +10,10 @@ export class CopyAsGFM {
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
if (isIOS) return;
- $(document).on('copy', '.md', e => {
+ $(document).on('copy', '.md', (e) => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection);
});
- $(document).on('copy', 'pre.code.highlight, table.code td.line_content', e => {
+ $(document).on('copy', 'pre.code.highlight, table.code td.line_content', (e) => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection);
});
$(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM);
@@ -42,7 +42,7 @@ export class CopyAsGFM {
clipboardData.setData('text/x-gfm-html', html);
CopyAsGFM.nodeToGFM(el)
- .then(res => {
+ .then((res) => {
clipboardData.setData('text/x-gfm', res);
})
.catch(() => {
@@ -71,7 +71,7 @@ export class CopyAsGFM {
const div = document.createElement('div');
div.innerHTML = gfmHtml;
CopyAsGFM.nodeToGFM(div)
- .then(transformedGfm => {
+ .then((transformedGfm) => {
CopyAsGFM.insertPastedText(e.target, text, transformedGfm);
})
.catch(() => {});
@@ -79,7 +79,7 @@ export class CopyAsGFM {
}
static insertPastedText(target, text, gfm) {
- insertText(target, textBefore => {
+ insertText(target, (textBefore) => {
// If the text before the cursor contains an odd number of backticks,
// we are either inside an inline code span that starts with 1 backtick
// or a code block that starts with 3 backticks.
@@ -125,7 +125,7 @@ export class CopyAsGFM {
let lineSelector = '.line';
if (target) {
- const lineClass = ['left-side', 'right-side'].filter(name =>
+ const lineClass = ['left-side', 'right-side'].filter((name) =>
target.classList.contains(name),
)[0];
if (lineClass) {
diff --git a/app/assets/javascripts/behaviors/markdown/highlight_current_user.js b/app/assets/javascripts/behaviors/markdown/highlight_current_user.js
index 6208b3f0032..0fac278573e 100644
--- a/app/assets/javascripts/behaviors/markdown/highlight_current_user.js
+++ b/app/assets/javascripts/behaviors/markdown/highlight_current_user.js
@@ -9,7 +9,7 @@ export default function highlightCurrentUser(elements) {
return;
}
- elements.forEach(element => {
+ elements.forEach((element) => {
if (parseInt(element.dataset.user, 10) === currentUserId) {
element.classList.add('current-user');
}
diff --git a/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js b/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
index ce425e80cd3..7f1506cd5d9 100644
--- a/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
+++ b/app/assets/javascripts/behaviors/markdown/marks/inline_diff.js
@@ -19,7 +19,7 @@ export default class InlineDiff extends Mark {
{ tag: 'span.idiff.addition', attrs: { addition: true } },
{ tag: 'span.idiff.deletion', attrs: { addition: false } },
],
- toDOM: node => [
+ toDOM: (node) => [
'span',
{ class: `idiff left right ${node.attrs.addition ? 'addition' : 'deletion'}` },
0,
diff --git a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
index f8465111959..556e6f7df1c 100644
--- a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
+++ b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
@@ -19,14 +19,14 @@ export default class InlineHTML extends Mark {
parseDOM: [
{
tag: 'sup, sub, kbd, q, samp, var',
- getAttrs: el => ({ tag: el.nodeName.toLowerCase() }),
+ getAttrs: (el) => ({ tag: el.nodeName.toLowerCase() }),
},
{
tag: 'abbr',
- getAttrs: el => ({ tag: 'abbr', title: el.getAttribute('title') }),
+ getAttrs: (el) => ({ tag: 'abbr', title: el.getAttribute('title') }),
},
],
- toDOM: node => [node.attrs.tag, { title: node.attrs.title }, 0],
+ toDOM: (node) => [node.attrs.tag, { title: node.attrs.title }, 0],
};
}
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/code_block.js b/app/assets/javascripts/behaviors/markdown/nodes/code_block.js
index 1e0c05eff08..cd90d67c60d 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/code_block.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/code_block.js
@@ -25,7 +25,7 @@ export default class CodeBlock extends BaseCodeBlock {
{
tag: 'pre.code.highlight',
preserveWhitespace: 'full',
- getAttrs: el => {
+ getAttrs: (el) => {
const lang = el.getAttribute('lang');
if (!lang || lang === '') return {};
@@ -62,13 +62,13 @@ export default class CodeBlock extends BaseCodeBlock {
tag: '.md-suggestion-diff',
preserveWhitespace: 'full',
getContent: (el, schema) =>
- [...el.querySelectorAll('.line_content.new span')].map(span =>
+ [...el.querySelectorAll('.line_content.new span')].map((span) =>
schema.text(span.innerText),
),
attrs: { lang: 'suggestion' },
},
],
- toDOM: node => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]],
+ toDOM: (node) => ['pre', { class: 'code highlight', lang: node.attrs.lang }, ['code', 0]],
};
}
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/emoji.js b/app/assets/javascripts/behaviors/markdown/nodes/emoji.js
index a7cc3e828f5..367a06ad3c1 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/emoji.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/emoji.js
@@ -20,14 +20,14 @@ export default class Emoji extends Node {
parseDOM: [
{
tag: 'gl-emoji',
- getAttrs: el => ({
+ getAttrs: (el) => ({
name: el.dataset.name,
title: el.getAttribute('title'),
moji: el.textContent,
}),
},
],
- toDOM: node => [
+ toDOM: (node) => [
'gl-emoji',
{ 'data-name': node.attrs.name, title: node.attrs.title },
node.attrs.moji,
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/image.js b/app/assets/javascripts/behaviors/markdown/nodes/image.js
index b1983eebe15..76746528e72 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/image.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/image.js
@@ -30,7 +30,7 @@ export default class Image extends BaseImage {
// Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter
{
tag: 'img[src]',
- getAttrs: el => {
+ getAttrs: (el) => {
const imageSrc = el.src;
const imageUrl =
imageSrc && imageSrc !== placeholderImage ? imageSrc : el.dataset.src || '';
@@ -43,7 +43,7 @@ export default class Image extends BaseImage {
},
},
],
- toDOM: node => ['img', node.attrs],
+ toDOM: (node) => ['img', node.attrs],
};
}
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/playable.js b/app/assets/javascripts/behaviors/markdown/nodes/playable.js
index 9a2c9c3c9b0..9cbd95a7bd8 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/playable.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/playable.js
@@ -42,11 +42,11 @@ export default class Playable extends Node {
},
{
tag: `${this.mediaType}[src]`,
- getAttrs: el => ({ src: el.src, alt: el.dataset.title }),
+ getAttrs: (el) => ({ src: el.src, alt: el.dataset.title }),
},
];
- const toDOM = node => [
+ const toDOM = (node) => [
this.mediaType,
{
src: node.attrs.src,
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/reference.js b/app/assets/javascripts/behaviors/markdown/nodes/reference.js
index aa724798da6..dd82ea58ea5 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/reference.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/reference.js
@@ -25,7 +25,7 @@ export default class Reference extends Node {
{
tag: 'a.gfm:not([data-link=true])',
priority: HIGHER_PARSE_RULE_PRIORITY,
- getAttrs: el => ({
+ getAttrs: (el) => ({
className: el.className,
referenceType: el.dataset.referenceType,
originalText: el.dataset.original,
@@ -34,7 +34,7 @@ export default class Reference extends Node {
}),
},
],
- toDOM: node => [
+ toDOM: (node) => [
'a',
{
class: node.attrs.className,
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js b/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
index c63bfe10e39..ebb66cd4da5 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/table_cell.js
@@ -19,13 +19,13 @@ export default class TableCell extends Node {
parseDOM: [
{
tag: 'td, th',
- getAttrs: el => ({
+ getAttrs: (el) => ({
header: el.tagName === 'TH',
align: el.getAttribute('align') || el.style.textAlign,
}),
},
],
- toDOM: node => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0],
+ toDOM: (node) => [node.attrs.header ? 'th' : 'td', { align: node.attrs.align }, 0],
};
}
diff --git a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
index 7bb56b4c406..56c2b17286d 100644
--- a/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
+++ b/app/assets/javascripts/behaviors/markdown/nodes/task_list_item.js
@@ -23,7 +23,7 @@ export default class TaskListItem extends Node {
{
priority: HIGHER_PARSE_RULE_PRIORITY,
tag: 'li.task-list-item',
- getAttrs: el => {
+ getAttrs: (el) => {
const checkbox = el.querySelector('input[type=checkbox].task-list-item-checkbox');
return { done: checkbox && checkbox.checked };
},
diff --git a/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js b/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js
index 278dd857ab8..46582867d05 100644
--- a/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js
+++ b/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js
@@ -1,4 +1,5 @@
-const maxColumnWidth = (rows, columnIndex) => Math.max(...rows.map(row => row[columnIndex].length));
+const maxColumnWidth = (rows, columnIndex) =>
+ Math.max(...rows.map((row) => row[columnIndex].length));
export default class PasteMarkdownTable {
constructor(clipboardData) {
@@ -16,7 +17,7 @@ export default class PasteMarkdownTable {
this.calculateColumnWidths();
const markdownRows = this.rows.map(
- row =>
+ (row) =>
// | Name | Title | Email Address |
// |--------------|-------|----------------|
// | Jane Atler | CEO | jane@acme.com |
@@ -66,7 +67,7 @@ export default class PasteMarkdownTable {
return false;
}
- this.rows = splitRows.map(row => row.split('\t'));
+ this.rows = splitRows.map((row) => row.split('\t'));
this.normalizeRows();
// Check that the max number of columns in the HTML matches the number of
@@ -81,10 +82,10 @@ export default class PasteMarkdownTable {
// Ensure each row has the same number of columns
normalizeRows() {
- const rowLengths = this.rows.map(row => row.length);
+ const rowLengths = this.rows.map((row) => row.length);
const maxLength = Math.max(...rowLengths);
- this.rows.forEach(row => {
+ this.rows.forEach((row) => {
while (row.length < maxLength) {
row.push('');
}
@@ -101,7 +102,7 @@ export default class PasteMarkdownTable {
const textColumnCount = this.rows[0].length;
let htmlColumnCount = 0;
- this.doc.querySelectorAll('table tr').forEach(row => {
+ this.doc.querySelectorAll('table tr').forEach((row) => {
htmlColumnCount = Math.max(row.cells.length, htmlColumnCount);
});
diff --git a/app/assets/javascripts/behaviors/markdown/render_math.js b/app/assets/javascripts/behaviors/markdown/render_math.js
index 30783562da9..f34fec4d449 100644
--- a/app/assets/javascripts/behaviors/markdown/render_math.js
+++ b/app/assets/javascripts/behaviors/markdown/render_math.js
@@ -35,7 +35,7 @@ const RENDER_FLASH_MSG = sprintf(
// Wait for the browser to reflow the layout. Reflowing SVG takes time.
// This has to wrap the inner function, otherwise IE/Edge throw "invalid calling object".
-const waitForReflow = fn => {
+const waitForReflow = (fn) => {
window.requestAnimationFrame(fn);
};
@@ -122,7 +122,7 @@ class SafeMathRenderer {
render() {
// Replace math blocks with a placeholder so they aren't rendered twice
- this.elements.forEach(el => {
+ this.elements.forEach((el) => {
const placeholder = document.createElement('span');
placeholder.style.display = 'none';
placeholder.setAttribute('data-math-style', el.getAttribute('data-math-style'));
diff --git a/app/assets/javascripts/behaviors/markdown/render_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
index 602f156dbf0..479782a1f1f 100644
--- a/app/assets/javascripts/behaviors/markdown/render_mermaid.js
+++ b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
@@ -29,7 +29,7 @@ let mermaidModule = {};
function importMermaidModule() {
return import(/* webpackChunkName: 'mermaid' */ 'mermaid')
- .then(mermaid => {
+ .then((mermaid) => {
let theme = 'neutral';
const ideDarkThemes = ['dark', 'solarized-dark', 'monokai'];
@@ -59,7 +59,7 @@ function importMermaidModule() {
return mermaid;
})
- .catch(err => {
+ .catch((err) => {
flash(sprintf(__("Can't load mermaid module: %{err}"), { err }));
// eslint-disable-next-line no-console
console.error(err);
@@ -77,7 +77,7 @@ function fixElementSource(el) {
}
function renderMermaidEl(el) {
- mermaidModule.init(undefined, el, id => {
+ mermaidModule.init(undefined, el, (id) => {
const source = el.textContent;
const svg = document.getElementById(id);
@@ -170,7 +170,7 @@ function renderMermaids($els) {
elsProcessingMap.set(el, requestId);
});
})
- .catch(err => {
+ .catch((err) => {
flash(sprintf(__('Encountered an error while rendering: %{err}'), { err }));
// eslint-disable-next-line no-console
console.error(err);
diff --git a/app/assets/javascripts/behaviors/markdown/render_metrics.js b/app/assets/javascripts/behaviors/markdown/render_metrics.js
index 37cbce46b6f..e7a2a6ce47c 100644
--- a/app/assets/javascripts/behaviors/markdown/render_metrics.js
+++ b/app/assets/javascripts/behaviors/markdown/render_metrics.js
@@ -9,7 +9,7 @@ export default function renderMetrics(elements) {
const wrapperList = [];
- elements.forEach(element => {
+ elements.forEach((element) => {
let wrapper;
const { previousElementSibling } = element;
const isFirstElementInGroup = !previousElementSibling?.urls;
@@ -33,7 +33,7 @@ export default function renderMetrics(elements) {
).then(({ default: EmbedGroup }) => {
const EmbedGroupComponent = Vue.extend(EmbedGroup);
- wrapperList.forEach(wrapper => {
+ wrapperList.forEach((wrapper) => {
// eslint-disable-next-line no-new
new EmbedGroupComponent({
el: wrapper,
diff --git a/app/assets/javascripts/behaviors/markdown/schema.js b/app/assets/javascripts/behaviors/markdown/schema.js
index 163182ab778..8bea24584cc 100644
--- a/app/assets/javascripts/behaviors/markdown/schema.js
+++ b/app/assets/javascripts/behaviors/markdown/schema.js
@@ -2,7 +2,7 @@ import { Schema } from 'prosemirror-model';
import editorExtensions from './editor_extensions';
const nodes = editorExtensions
- .filter(extension => extension.type === 'node')
+ .filter((extension) => extension.type === 'node')
.reduce(
(ns, { name, schema }) => ({
...ns,
@@ -12,7 +12,7 @@ const nodes = editorExtensions
);
const marks = editorExtensions
- .filter(extension => extension.type === 'mark')
+ .filter((extension) => extension.type === 'mark')
.reduce(
(ms, { name, schema }) => ({
...ms,
diff --git a/app/assets/javascripts/behaviors/markdown/serializer.js b/app/assets/javascripts/behaviors/markdown/serializer.js
index 70dbd8bd206..b4adf1a413f 100644
--- a/app/assets/javascripts/behaviors/markdown/serializer.js
+++ b/app/assets/javascripts/behaviors/markdown/serializer.js
@@ -2,7 +2,7 @@ import { MarkdownSerializer } from 'prosemirror-markdown';
import editorExtensions from './editor_extensions';
const nodes = editorExtensions
- .filter(extension => extension.type === 'node')
+ .filter((extension) => extension.type === 'node')
.reduce(
(ns, { name, toMarkdown }) => ({
...ns,
@@ -12,7 +12,7 @@ const nodes = editorExtensions
);
const marks = editorExtensions
- .filter(extension => extension.type === 'mark')
+ .filter((extension) => extension.type === 'mark')
.reduce(
(ms, { name, toMarkdown }) => ({
...ms,
diff --git a/app/assets/javascripts/behaviors/preview_markdown.js b/app/assets/javascripts/behaviors/preview_markdown.js
index 84bf22586a9..def1c567cd5 100644
--- a/app/assets/javascripts/behaviors/preview_markdown.js
+++ b/app/assets/javascripts/behaviors/preview_markdown.js
@@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.');
MarkdownPreview.prototype.ajaxCache = {};
-MarkdownPreview.prototype.showPreview = function($form) {
+MarkdownPreview.prototype.showPreview = function ($form) {
const preview = $form.find('.js-md-preview');
const url = preview.data('url');
if (preview.hasClass('md-preview-loading')) {
@@ -41,7 +41,7 @@ MarkdownPreview.prototype.showPreview = function($form) {
this.hideReferencedUsers($form);
} else {
preview.addClass('md-preview-loading').text(__('Loading...'));
- this.fetchMarkdownPreview(mdText, url, response => {
+ this.fetchMarkdownPreview(mdText, url, (response) => {
let body;
if (response.body.length > 0) {
({ body } = response);
@@ -60,7 +60,7 @@ MarkdownPreview.prototype.showPreview = function($form) {
}
};
-MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
+MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
if (!url) {
return;
}
@@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
.catch(() => flash(__('An error occurred while fetching markdown preview')));
};
-MarkdownPreview.prototype.hideReferencedUsers = function($form) {
+MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
$form.find('.referenced-users').hide();
};
-MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
+MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
const referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) {
if (users.length >= this.referenceThreshold) {
@@ -98,11 +98,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
}
};
-MarkdownPreview.prototype.hideReferencedCommands = function($form) {
+MarkdownPreview.prototype.hideReferencedCommands = function ($form) {
$form.find('.referenced-commands').hide();
};
-MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) {
+MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) {
const referencedCommands = $form.find('.referenced-commands');
if (commands.length > 0) {
referencedCommands.html(commands);
@@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button';
lastTextareaPreviewed = null;
const markdownToolbar = $('.md-header-toolbar');
-$.fn.setupMarkdownPreview = function() {
+$.fn.setupMarkdownPreview = function () {
const $form = $(this);
$form.find('textarea.markdown-area').on('input', () => {
markdownPreview.hideReferencedUsers($form);
@@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => {
lastTextareaHeight = lastTextareaPreviewed.height();
// toggle tabs
- $form
- .find(writeButtonSelector)
- .parent()
- .removeClass('active');
- $form
- .find(previewButtonSelector)
- .parent()
- .addClass('active');
+ $form.find(writeButtonSelector).parent().removeClass('active');
+ $form.find(previewButtonSelector).parent().addClass('active');
// toggle content
$form.find('.md-write-holder').hide();
@@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => {
}
// toggle tabs
- $form
- .find(writeButtonSelector)
- .parent()
- .addClass('active');
- $form
- .find(previewButtonSelector)
- .parent()
- .removeClass('active');
+ $form.find(writeButtonSelector).parent().addClass('active');
+ $form.find(previewButtonSelector).parent().removeClass('active');
// toggle content
$form.find('.md-write-holder').show();
@@ -194,13 +182,13 @@ $(document).on('markdown-preview:toggle', (e, keyboardEvent) => {
}
});
-$(document).on('click', previewButtonSelector, function(e) {
+$(document).on('click', previewButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:show', [$form]);
});
-$(document).on('click', writeButtonSelector, function(e) {
+$(document).on('click', writeButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:hide', [$form]);
diff --git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js
index 907cfc06e28..68e831252d6 100644
--- a/app/assets/javascripts/behaviors/quick_submit.js
+++ b/app/assets/javascripts/behaviors/quick_submit.js
@@ -30,7 +30,7 @@ function keyCodeIs(e, keyCode) {
return e.keyCode === keyCode;
}
-$(document).on('keydown.quick_submit', '.js-quick-submit', e => {
+$(document).on('keydown.quick_submit', '.js-quick-submit', (e) => {
// Enter
if (!keyCodeIs(e, 13)) {
return;
diff --git a/app/assets/javascripts/behaviors/requires_input.js b/app/assets/javascripts/behaviors/requires_input.js
index 2fa3f4fc789..b1227fb3533 100644
--- a/app/assets/javascripts/behaviors/requires_input.js
+++ b/app/assets/javascripts/behaviors/requires_input.js
@@ -23,7 +23,7 @@ $.fn.requiresInput = function requiresInput() {
function requireInput() {
// Collect the input values of *all* required fields
- const values = Array.from($(fieldSelector, $form)).map(field => field.value);
+ const values = Array.from($(fieldSelector, $form)).map((field) => field.value);
// Disable the button if any required fields are empty
if (values.length && values.some(isEmpty)) {
diff --git a/app/assets/javascripts/behaviors/secret_values.js b/app/assets/javascripts/behaviors/secret_values.js
index 5b92608d536..2f1951c97f9 100644
--- a/app/assets/javascripts/behaviors/secret_values.js
+++ b/app/assets/javascripts/behaviors/secret_values.js
@@ -30,12 +30,12 @@ export default class SecretValues {
updateDom(isRevealed) {
const values = this.container.querySelectorAll(this.valueSelector);
- values.forEach(value => {
+ values.forEach((value) => {
value.classList.toggle('hide', !isRevealed);
});
const placeholders = this.container.querySelectorAll(this.placeholderSelector);
- placeholders.forEach(placeholder => {
+ placeholders.forEach((placeholder) => {
placeholder.classList.toggle('hide', isRevealed);
});
diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js
index bbcc40ab9fe..10832583783 100644
--- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js
+++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js
@@ -49,10 +49,10 @@ export const keybindingGroups = [
// For each keybinding object, add a `customKeys` property populated with the
// user's custom keybindings (if the command has been customized).
// `customKeys` will be `undefined` if the command hasn't been customized.
- .map(group => {
+ .map((group) => {
return {
...group,
- keybindings: group.keybindings.map(binding => ({
+ keybindings: group.keybindings.map((binding) => ({
...binding,
customKeys: customizations[binding.command],
})),
@@ -66,7 +66,7 @@ export const keybindingGroups = [
* @example
* { "globalShortcuts.togglePerformanceBar": ["p e r f"] }
*/
-const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)).reduce(
+const commandToKeys = flatten(keybindingGroups.map((group) => group.keybindings)).reduce(
(acc, binding) => {
acc[binding.command] = binding.customKeys || binding.defaultKeys;
return acc;
@@ -87,7 +87,7 @@ const commandToKeys = flatten(keybindingGroups.map(group => group.keybindings)).
*
* Mousetrap.bind(keysFor(TOGGLE_PERFORMANCE_BAR), handler);
*/
-export const keysFor = command => {
+export const keysFor = (command) => {
if (shouldDisableShortcuts()) {
return [];
}
diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js
index c0f67923191..50d2399b312 100644
--- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js
+++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js
@@ -98,9 +98,7 @@ export default class Shortcuts {
});
// eslint-disable-next-line @gitlab/no-global-event-off
- $('.js-shortcuts-modal-trigger')
- .off('click')
- .on('click', this.onToggleHelp);
+ $('.js-shortcuts-modal-trigger').off('click').on('click', this.onToggleHelp);
if (shouldDisableShortcuts()) {
disableShortcuts();
@@ -199,7 +197,7 @@ export default class Shortcuts {
$textarea.data(LOCAL_MOUSETRAP_DATA_KEY, localMousetrap);
toolbarBtnToShortcutsMap.forEach((keyboardShortcuts, $toolbarBtn) => {
- localMousetrap.bind(keyboardShortcuts, e => {
+ localMousetrap.bind(keyboardShortcuts, (e) => {
e.preventDefault();
handler($toolbarBtn);
@@ -233,7 +231,7 @@ export default class Shortcuts {
const localMousetrap = $textarea.data(LOCAL_MOUSETRAP_DATA_KEY);
if (localMousetrap) {
- getToolbarBtnToShortcutsMap($textarea).forEach(keyboardShortcuts => {
+ getToolbarBtnToShortcutsMap($textarea).forEach((keyboardShortcuts) => {
localMousetrap.unbind(keyboardShortcuts);
});
}
diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js
index c35a073b291..11b4fcd4e1c 100644
--- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js
+++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_blob.js
@@ -53,7 +53,7 @@ export default class ShortcutsBlob extends Shortcuts {
shortcircuitPermalinkButton() {
const button = this.options.fileBlobPermalinkUrlElement;
- const handleButton = e => {
+ const handleButton = (e) => {
if (!eventHasModifierKeys(e)) {
e.preventDefault();
this.moveToFilePermalink();
diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js
index 5a5a67334d3..5e8ddeb6af7 100644
--- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js
+++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js
@@ -39,7 +39,7 @@ export default class ShortcutsIssuable extends Shortcuts {
// ... Or come from a message
if (!foundMessage) {
if (documentFragment.originalNodes) {
- documentFragment.originalNodes.forEach(e => {
+ documentFragment.originalNodes.forEach((e) => {
let node = e;
do {
// Text nodes don't define the `matches` method
@@ -62,7 +62,7 @@ export default class ShortcutsIssuable extends Shortcuts {
const blockquoteEl = document.createElement('blockquote');
blockquoteEl.appendChild(el);
CopyAsGFM.nodeToGFM(blockquoteEl)
- .then(text => {
+ .then((text) => {
if (text.trim() === '') {
return false;
}