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-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/static_site_editor/components
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/static_site_editor/components')
-rw-r--r--app/assets/javascripts/static_site_editor/components/app.vue12
-rw-r--r--app/assets/javascripts/static_site_editor/components/edit_area.vue18
-rw-r--r--app/assets/javascripts/static_site_editor/components/saved_changes_message.vue79
3 files changed, 26 insertions, 83 deletions
diff --git a/app/assets/javascripts/static_site_editor/components/app.vue b/app/assets/javascripts/static_site_editor/components/app.vue
index 98240aef810..365fc7ce6e9 100644
--- a/app/assets/javascripts/static_site_editor/components/app.vue
+++ b/app/assets/javascripts/static_site_editor/components/app.vue
@@ -1,3 +1,13 @@
+<script>
+export default {
+ props: {
+ mergeRequestsIllustrationPath: {
+ type: String,
+ required: true,
+ },
+ },
+};
+</script>
<template>
- <router-view />
+ <router-view :merge-requests-illustration-path="mergeRequestsIllustrationPath" />
</template>
diff --git a/app/assets/javascripts/static_site_editor/components/edit_area.vue b/app/assets/javascripts/static_site_editor/components/edit_area.vue
index 84a16f327d9..53fbb2a330d 100644
--- a/app/assets/javascripts/static_site_editor/components/edit_area.vue
+++ b/app/assets/javascripts/static_site_editor/components/edit_area.vue
@@ -7,6 +7,8 @@ import parseSourceFile from '~/static_site_editor/services/parse_source_file';
import { EDITOR_TYPES } from '~/vue_shared/components/rich_content_editor/constants';
import { DEFAULT_IMAGE_UPLOAD_PATH } from '../constants';
import imageRepository from '../image_repository';
+import formatter from '../services/formatter';
+import templater from '../services/templater';
export default {
components: {
@@ -43,7 +45,7 @@ export default {
data() {
return {
saveable: false,
- parsedSource: parseSourceFile(this.content),
+ parsedSource: parseSourceFile(this.preProcess(true, this.content)),
editorMode: EDITOR_TYPES.wysiwyg,
isModified: false,
};
@@ -58,20 +60,30 @@ export default {
},
},
methods: {
+ preProcess(isWrap, value) {
+ const formattedContent = formatter(value);
+ const templatedContent = isWrap
+ ? templater.wrap(formattedContent)
+ : templater.unwrap(formattedContent);
+ return templatedContent;
+ },
onInputChange(newVal) {
this.parsedSource.sync(newVal, this.isWysiwygMode);
this.isModified = this.parsedSource.isModified();
},
onModeChange(mode) {
this.editorMode = mode;
- this.$refs.editor.resetInitialValue(this.editableContent);
+
+ const preProcessedContent = this.preProcess(this.isWysiwygMode, this.editableContent);
+ this.$refs.editor.resetInitialValue(preProcessedContent);
},
onUploadImage({ file, imageUrl }) {
this.$options.imageRepository.add(file, imageUrl);
},
onSubmit() {
+ const preProcessedContent = this.preProcess(false, this.parsedSource.content());
this.$emit('submit', {
- content: this.parsedSource.content(),
+ content: preProcessedContent,
images: this.$options.imageRepository.getAll(),
});
},
diff --git a/app/assets/javascripts/static_site_editor/components/saved_changes_message.vue b/app/assets/javascripts/static_site_editor/components/saved_changes_message.vue
deleted file mode 100644
index dd907570114..00000000000
--- a/app/assets/javascripts/static_site_editor/components/saved_changes_message.vue
+++ /dev/null
@@ -1,79 +0,0 @@
-<script>
-import { isString } from 'lodash';
-
-import { GlLink, GlButton } from '@gitlab/ui';
-
-const validateUrlAndLabel = value => isString(value.label) && isString(value.url);
-
-export default {
- components: {
- GlLink,
- GlButton,
- },
- props: {
- branch: {
- type: Object,
- required: true,
- validator: validateUrlAndLabel,
- },
- commit: {
- type: Object,
- required: true,
- validator: validateUrlAndLabel,
- },
- mergeRequest: {
- type: Object,
- required: true,
- validator: validateUrlAndLabel,
- },
- returnUrl: {
- type: String,
- required: false,
- default: '',
- },
- },
-};
-</script>
-
-<template>
- <div>
- <div class="border-bottom pb-4">
- <h3>{{ s__('StaticSiteEditor|Success!') }}</h3>
- <p>
- {{
- s__(
- 'StaticSiteEditor|Your changes have been submitted and a merge request has been created. The changes won’t be visible on the site until the merge request has been accepted.',
- )
- }}
- </p>
- <div class="d-flex justify-content-end">
- <gl-button v-if="returnUrl" ref="returnToSiteButton" :href="returnUrl">{{
- s__('StaticSiteEditor|Return to site')
- }}</gl-button>
- <gl-button ref="mergeRequestButton" class="ml-2" :href="mergeRequest.url" variant="success">
- {{ s__('StaticSiteEditor|View merge request') }}
- </gl-button>
- </div>
- </div>
-
- <div class="pt-2">
- <h4>{{ s__('StaticSiteEditor|Summary of changes') }}</h4>
- <ul>
- <li>
- {{ s__('StaticSiteEditor|You created a new branch:') }}
- <gl-link ref="branchLink" :href="branch.url">{{ branch.label }}</gl-link>
- </li>
- <li>
- {{ s__('StaticSiteEditor|You created a merge request:') }}
- <gl-link ref="mergeRequestLink" :href="mergeRequest.url">{{
- mergeRequest.label
- }}</gl-link>
- </li>
- <li>
- {{ s__('StaticSiteEditor|You added a commit:') }}
- <gl-link ref="commitLink" :href="commit.url">{{ commit.label }}</gl-link>
- </li>
- </ul>
- </div>
- </div>
-</template>