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-06-17 18:08:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-17 18:08:36 +0300
commitc61d90dbfa0a7cb58b758ed07a9d0b5406beb61e (patch)
tree5c29d476a605417c370997caf3dabe8e8270b8be /app/assets/javascripts/static_site_editor
parenta89912871cb169249d3ddc2ed59326d47ecdae82 (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/components/edit_area.vue7
-rw-r--r--app/assets/javascripts/static_site_editor/services/parse_source_file.js8
2 files changed, 8 insertions, 7 deletions
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 e9efef40632..b8c6be51afa 100644
--- a/app/assets/javascripts/static_site_editor/components/edit_area.vue
+++ b/app/assets/javascripts/static_site_editor/components/edit_area.vue
@@ -58,15 +58,16 @@ export default {
methods: {
syncSource() {
if (this.isWysiwygMode) {
- this.parsedSource.syncBody();
+ this.parsedSource.syncBodyToRaw();
return;
}
- this.parsedSource.syncRaw();
+ this.parsedSource.syncRawToBody();
},
onModeChange(mode) {
- this.editorMode = mode;
+ // Sequentially sync then switch modes (rich-content-editor's v-model computed source content update)
this.syncSource();
+ this.editorMode = mode;
},
onSubmit() {
this.syncSource();
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 f32c693411f..c22bd1d27f2 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
@@ -24,7 +24,7 @@ const parseSourceFile = raw => {
const computedRaw = () => `${editable.header}${editable.spacing}${editable.body}`;
- const syncBody = () => {
+ const syncRawToBody = () => {
/*
We re-parse as markdown editing could have added non-body changes (preFrontMatter, frontMatter, or spacing).
Re-parsing additionally gets us the desired body that was extracted from the mutated editable.raw
@@ -33,7 +33,7 @@ const parseSourceFile = raw => {
Object.assign(editable, parse(editable.raw));
};
- const syncRaw = () => {
+ const syncBodyToRaw = () => {
editable.raw = computedRaw();
};
@@ -47,8 +47,8 @@ const parseSourceFile = raw => {
editable,
isModifiedRaw,
isModifiedBody,
- syncRaw,
- syncBody,
+ syncBodyToRaw,
+ syncRawToBody,
};
};