summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js2
-rw-r--r--app/assets/javascripts/notes/components/issue_note.vue11
-rw-r--r--app/assets/javascripts/vue_shared/components/markdown/field.vue20
3 files changed, 16 insertions, 17 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index c2b56ee5904..dce5e76ecee 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -32,7 +32,7 @@
const action = gl.utils.getPagePath(2);
return page === 'issues' && action === 'show';
- }
+ };
w.gl.utils.ajaxGet = function(url) {
return $.ajax({
diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue
index 2ed803fab96..659043d9fa1 100644
--- a/app/assets/javascripts/notes/components/issue_note.vue
+++ b/app/assets/javascripts/notes/components/issue_note.vue
@@ -86,16 +86,17 @@
this.updateNote(data)
.then(() => {
this.isEditing = false;
- // TODO: this could be moved down, by setting a prop
$(this.$refs.noteBody.$el).renderGFM();
this.$refs.noteBody.resetAutoSave();
+ callback();
})
- .catch(() => Flash(
+ .catch(() => {
+ Flash(
'Something went wrong while editing your comment. Please try again.',
'alert',
- $(parentElement),
- ))
- .then(callback);
+ $(parentElement));
+ callback();
+ });
},
formCancelHandler(shouldConfirm, isDirty) {
if (shouldConfirm && isDirty) {
diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue
index 9e93feeda3b..759d30c9c7c 100644
--- a/app/assets/javascripts/vue_shared/components/markdown/field.vue
+++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue
@@ -55,18 +55,16 @@
if (!this.previewMarkdown) {
this.markdownPreview = '';
+ } else if (text) {
+ this.markdownPreviewLoading = true;
+ this.$http.post(this.markdownPreviewPath, { text })
+ .then(resp => resp.json())
+ .then((data) => {
+ this.renderMarkdown(data);
+ })
+ .catch(() => new Flash('Error loading markdown preview'));
} else {
- if (text) {
- this.markdownPreviewLoading = true;
- this.$http.post(this.markdownPreviewPath, { text })
- .then(resp => resp.json())
- .then((data) => {
- this.renderMarkdown(data);
- })
- .catch(() => new Flash('Error loading markdown preview'));
- } else {
- this.renderMarkdown();
- }
+ this.renderMarkdown();
}
},
renderMarkdown(data = {}) {