Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-24 00:10:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-24 00:10:24 +0300
commit5838993b5f3e2d861d9dd7c82dfeea71506b9fc2 (patch)
treecaab6621fb79f06a355f802dc885982f746b544d /app/assets/javascripts/static_site_editor
parentb8d021cb606ac86f41a0ef9dacd133a9677f8414 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/static_site_editor')
-rw-r--r--app/assets/javascripts/static_site_editor/graphql/index.js4
-rw-r--r--app/assets/javascripts/static_site_editor/graphql/resolvers/file.js2
-rw-r--r--app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js2
-rw-r--r--app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js4
-rw-r--r--app/assets/javascripts/static_site_editor/image_repository.js6
-rw-r--r--app/assets/javascripts/static_site_editor/index.js2
-rw-r--r--app/assets/javascripts/static_site_editor/pages/home.vue2
-rw-r--r--app/assets/javascripts/static_site_editor/services/formatter.js6
-rw-r--r--app/assets/javascripts/static_site_editor/services/front_matterify.js2
-rw-r--r--app/assets/javascripts/static_site_editor/services/image_service.js4
-rw-r--r--app/assets/javascripts/static_site_editor/services/load_source_content.js2
-rw-r--r--app/assets/javascripts/static_site_editor/services/parse_source_file.js4
-rw-r--r--app/assets/javascripts/static_site_editor/services/renderers/render_image.js10
-rw-r--r--app/assets/javascripts/static_site_editor/services/submit_content_changes.js2
-rw-r--r--app/assets/javascripts/static_site_editor/services/templater.js10
15 files changed, 31 insertions, 31 deletions
diff --git a/app/assets/javascripts/static_site_editor/graphql/index.js b/app/assets/javascripts/static_site_editor/graphql/index.js
index a13f7d3ad53..bce320ed805 100644
--- a/app/assets/javascripts/static_site_editor/graphql/index.js
+++ b/app/assets/javascripts/static_site_editor/graphql/index.js
@@ -8,7 +8,7 @@ import hasSubmittedChangesResolver from './resolvers/has_submitted_changes';
Vue.use(VueApollo);
-const createApolloProvider = appData => {
+const createApolloProvider = (appData) => {
const defaultClient = createDefaultClient(
{
Project: {
@@ -26,7 +26,7 @@ const createApolloProvider = appData => {
);
// eslint-disable-next-line @gitlab/require-i18n-strings
- const mounts = appData.mounts.map(mount => ({ __typename: 'Mount', ...mount }));
+ const mounts = appData.mounts.map((mount) => ({ __typename: 'Mount', ...mount }));
defaultClient.cache.writeData({
data: {
diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js
index 16f176581cb..fc3cac52e2a 100644
--- a/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js
+++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/file.js
@@ -1,7 +1,7 @@
import loadSourceContent from '../../services/load_source_content';
const fileResolver = ({ fullPath: projectId }, { path: sourcePath }) => {
- return loadSourceContent({ projectId, sourcePath }).then(sourceContent => ({
+ return loadSourceContent({ projectId, sourcePath }).then((sourceContent) => ({
// eslint-disable-next-line @gitlab/require-i18n-strings
__typename: 'File',
...sourceContent,
diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js
index ea49b21eb0d..35ecf6d698c 100644
--- a/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js
+++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/has_submitted_changes.js
@@ -4,7 +4,7 @@ import query from '../queries/app_data.query.graphql';
const hasSubmittedChangesResolver = (_, { input: { hasSubmittedChanges } }, { cache }) => {
const oldData = cache.readQuery({ query });
- const data = produce(oldData, draftState => {
+ const data = produce(oldData, (draftState) => {
// punctually modifying draftState as per immer docs upsets our linters
return {
...draftState,
diff --git a/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js b/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js
index 1bd79d40071..0b74c99b319 100644
--- a/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js
+++ b/app/assets/javascripts/static_site_editor/graphql/resolvers/submit_content_changes.js
@@ -25,8 +25,8 @@ const submitContentChangesResolver = (
images,
mergeRequestMeta,
formattedMarkdown,
- }).then(savedContentMeta => {
- const data = produce(savedContentMeta, draftState => {
+ }).then((savedContentMeta) => {
+ const data = produce(savedContentMeta, (draftState) => {
return {
savedContentMeta: {
__typename: 'SavedContentMeta',
diff --git a/app/assets/javascripts/static_site_editor/image_repository.js b/app/assets/javascripts/static_site_editor/image_repository.js
index b5ff4385d3c..56b2434d2e2 100644
--- a/app/assets/javascripts/static_site_editor/image_repository.js
+++ b/app/assets/javascripts/static_site_editor/image_repository.js
@@ -4,15 +4,15 @@ import { getBinary } from './services/image_service';
const imageRepository = () => {
const images = new Map();
- const flash = message => new Flash(message);
+ const flash = (message) => new Flash(message);
const add = (file, url) => {
getBinary(file)
- .then(content => images.set(url, content))
+ .then((content) => images.set(url, content))
.catch(() => flash(__('Something went wrong while inserting your image. Please try again.')));
};
- const get = path => images.get(path);
+ const get = (path) => images.get(path);
const getAll = () => images;
diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js
index b58564388de..fbb14be21ba 100644
--- a/app/assets/javascripts/static_site_editor/index.js
+++ b/app/assets/javascripts/static_site_editor/index.js
@@ -4,7 +4,7 @@ import App from './components/app.vue';
import createRouter from './router';
import createApolloProvider from './graphql';
-const initStaticSiteEditor = el => {
+const initStaticSiteEditor = (el) => {
const {
isSupportedContent,
path: sourcePath,
diff --git a/app/assets/javascripts/static_site_editor/pages/home.vue b/app/assets/javascripts/static_site_editor/pages/home.vue
index 1e52e73294e..6c958cb2d22 100644
--- a/app/assets/javascripts/static_site_editor/pages/home.vue
+++ b/app/assets/javascripts/static_site_editor/pages/home.vue
@@ -118,7 +118,7 @@ export default {
},
},
})
- .catch(e => {
+ .catch((e) => {
this.submitChangesError = e.message;
})
.finally(() => {
diff --git a/app/assets/javascripts/static_site_editor/services/formatter.js b/app/assets/javascripts/static_site_editor/services/formatter.js
index 9a5dcd307eb..e841c664406 100644
--- a/app/assets/javascripts/static_site_editor/services/formatter.js
+++ b/app/assets/javascripts/static_site_editor/services/formatter.js
@@ -24,7 +24,7 @@ const nestedLineRegexp = /^\s+/;
* This function attempts to correct this problem before the content is loaded
* by Toast UI.
*/
-const correctNestedContentIndenation = source => {
+const correctNestedContentIndenation = (source) => {
const lines = source.split('\n');
let topLevelOrderedListDetected = false;
@@ -40,7 +40,7 @@ const correctNestedContentIndenation = source => {
.join('\n');
};
-const removeOrphanedBrTags = source => {
+const removeOrphanedBrTags = (source) => {
/* Until the underlying Squire editor of Toast UI Editor resolves duplicate `<br>` tags, this
`replace` solution will clear out orphaned `<br>` tags that it generates. Additionally,
it cleans up orphaned `<br>` tags in the source markdown document that should be new lines.
@@ -49,7 +49,7 @@ const removeOrphanedBrTags = source => {
return source.replace(/\n^<br>$/gm, '');
};
-const format = source => {
+const format = (source) => {
return correctNestedContentIndenation(removeOrphanedBrTags(source));
};
diff --git a/app/assets/javascripts/static_site_editor/services/front_matterify.js b/app/assets/javascripts/static_site_editor/services/front_matterify.js
index 60a5d799d11..6b897b42648 100644
--- a/app/assets/javascripts/static_site_editor/services/front_matterify.js
+++ b/app/assets/javascripts/static_site_editor/services/front_matterify.js
@@ -8,7 +8,7 @@ const hasMatter = (firstThreeChars, fourthChar) => {
return isYamlDelimiter && isFourthCharNewline;
};
-export const frontMatterify = source => {
+export const frontMatterify = (source) => {
let index = 3;
let offset;
const delimiter = source.slice(0, index);
diff --git a/app/assets/javascripts/static_site_editor/services/image_service.js b/app/assets/javascripts/static_site_editor/services/image_service.js
index 25ab1084572..a9b85057e3d 100644
--- a/app/assets/javascripts/static_site_editor/services/image_service.js
+++ b/app/assets/javascripts/static_site_editor/services/image_service.js
@@ -1,8 +1,8 @@
-export const getBinary = file => {
+export const getBinary = (file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result.split(',')[1]);
- reader.onerror = error => reject(error);
+ reader.onerror = (error) => reject(error);
});
};
diff --git a/app/assets/javascripts/static_site_editor/services/load_source_content.js b/app/assets/javascripts/static_site_editor/services/load_source_content.js
index 1af93a8a2bc..fcf69efafd8 100644
--- a/app/assets/javascripts/static_site_editor/services/load_source_content.js
+++ b/app/assets/javascripts/static_site_editor/services/load_source_content.js
@@ -1,6 +1,6 @@
import Api from '~/api';
-const extractTitle = content => {
+const extractTitle = (content) => {
const matches = content.match(/title: (.+)\n/i);
return matches ? Array.from(matches)[1] : '';
diff --git a/app/assets/javascripts/static_site_editor/services/parse_source_file.js b/app/assets/javascripts/static_site_editor/services/parse_source_file.js
index 39126eb7bcc..d7499d75a21 100644
--- a/app/assets/javascripts/static_site_editor/services/parse_source_file.js
+++ b/app/assets/javascripts/static_site_editor/services/parse_source_file.js
@@ -1,6 +1,6 @@
import { frontMatterify, stringify } from './front_matterify';
-const parseSourceFile = raw => {
+const parseSourceFile = (raw) => {
let editable;
const syncContent = (newVal, isBody) => {
@@ -20,7 +20,7 @@ const parseSourceFile = raw => {
const matter = () => editable.matter;
- const syncMatter = settings => {
+ const syncMatter = (settings) => {
editable.matter = settings;
};
diff --git a/app/assets/javascripts/static_site_editor/services/renderers/render_image.js b/app/assets/javascripts/static_site_editor/services/renderers/render_image.js
index b0d863bdb5a..b5651e7163e 100644
--- a/app/assets/javascripts/static_site_editor/services/renderers/render_image.js
+++ b/app/assets/javascripts/static_site_editor/services/renderers/render_image.js
@@ -4,16 +4,16 @@ const canRender = ({ type }) => type === 'image';
let metadata;
-const getCachedContent = basePath => metadata.imageRepository.get(basePath);
+const getCachedContent = (basePath) => metadata.imageRepository.get(basePath);
-const isRelativeToCurrentDirectory = basePath => !basePath.startsWith('/');
+const isRelativeToCurrentDirectory = (basePath) => !basePath.startsWith('/');
-const extractSourceDirectory = url => {
+const extractSourceDirectory = (url) => {
const sourceDir = /^(.+)\/([^/]+)$/.exec(url); // Extracts the base path and fileName from an image path
return sourceDir || [null, null, url]; // If no source directory was extracted it means only a fileName was specified (e.g. url='file.png')
};
-const parseCurrentDirectory = basePath => {
+const parseCurrentDirectory = (basePath) => {
const baseUrl = decodeURIComponent(metadata.baseUrl);
const sourceDirectory = extractSourceDirectory(baseUrl)[1];
const currentDirectory = sourceDirectory.split(`/-/sse/${metadata.branch}`)[1];
@@ -23,7 +23,7 @@ const parseCurrentDirectory = basePath => {
// For more context around this logic, please see the following comment:
// https://gitlab.com/gitlab-org/gitlab/-/issues/241166#note_409413500
-const generateSourceDirectory = basePath => {
+const generateSourceDirectory = (basePath) => {
let sourceDir = '';
let defaultSourceDir = '';
diff --git a/app/assets/javascripts/static_site_editor/services/submit_content_changes.js b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js
index e57028ea05a..84e90deacfc 100644
--- a/app/assets/javascripts/static_site_editor/services/submit_content_changes.js
+++ b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js
@@ -32,7 +32,7 @@ const createImageActions = (images, markdown) => {
}
images.forEach((imageContent, filePath) => {
- const imageExistsInMarkdown = path => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>)
+ const imageExistsInMarkdown = (path) => new RegExp(`!\\[([^[\\]\\n]*)\\](\\(${path})\\)`); // matches the image markdown syntax: ![<any-string-except-newline>](<path>)
if (imageExistsInMarkdown(filePath).test(markdown)) {
actions.push(
diff --git a/app/assets/javascripts/static_site_editor/services/templater.js b/app/assets/javascripts/static_site_editor/services/templater.js
index d302aea78a3..47fc36c3d18 100644
--- a/app/assets/javascripts/static_site_editor/services/templater.js
+++ b/app/assets/javascripts/static_site_editor/services/templater.js
@@ -40,10 +40,10 @@ const mark = (source, groups) => {
const hash = {};
Object.entries(groups).forEach(([groupKey, group]) => {
- group.forEach(pattern => {
+ group.forEach((pattern) => {
const matches = text.match(pattern);
if (matches) {
- matches.forEach(match => {
+ matches.forEach((match) => {
const key = `${markPrefix}-${groupKey}-${id}`;
text = text.replace(match, key);
hash[key] = match;
@@ -67,12 +67,12 @@ const unmark = (text, hash) => {
return source;
};
-const unwrap = source => {
+const unwrap = (source) => {
let text = source;
const matches = text.match(reTemplated);
if (matches) {
- matches.forEach(match => {
+ matches.forEach((match) => {
const initial = match.replace(`${wrapPrefix}`, '').replace(`${wrapPostfix}`, '');
text = text.replace(match, initial);
});
@@ -81,7 +81,7 @@ const unwrap = source => {
return text;
};
-const wrap = source => {
+const wrap = (source) => {
const { text, hash } = mark(unwrap(source), patternGroups);
return unmark(text, hash);
};