Commit 1285fe68 authored by Winnie Hellmann's avatar Winnie Hellmann

Remove unnecessary div from MarkdownField to apply list styles correctly

parent b388111f
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { s__ } from '~/locale'; import { __ } from '~/locale';
import Flash from '../../../flash'; import Flash from '../../../flash';
import GLForm from '../../../gl_form'; import GLForm from '../../../gl_form';
import markdownHeader from './header.vue'; import markdownHeader from './header.vue';
...@@ -99,11 +99,12 @@ export default { ...@@ -99,11 +99,12 @@ export default {
if (text) { if (text) {
this.markdownPreviewLoading = true; this.markdownPreviewLoading = true;
this.markdownPreview = __('Loading…');
this.$http this.$http
.post(this.versionedPreviewPath(), { text }) .post(this.versionedPreviewPath(), { text })
.then(resp => resp.json()) .then(resp => resp.json())
.then(data => this.renderMarkdown(data)) .then(data => this.renderMarkdown(data))
.catch(() => new Flash(s__('Error loading markdown preview'))); .catch(() => new Flash(__('Error loading markdown preview')));
} else { } else {
this.renderMarkdown(); this.renderMarkdown();
} }
...@@ -162,10 +163,12 @@ export default { ...@@ -162,10 +163,12 @@ export default {
/> />
</div> </div>
</div> </div>
<div v-show="previewMarkdown" class="md md-preview-holder md-preview js-vue-md-preview"> <div
<div ref="markdown-preview" v-html="markdownPreview"></div> v-show="previewMarkdown"
<span v-if="markdownPreviewLoading"> Loading... </span> ref="markdown-preview"
</div> class="md-preview js-vue-md-preview md md-preview-holder"
v-html="markdownPreview"
></div>
<template v-if="previewMarkdown && !markdownPreviewLoading"> <template v-if="previewMarkdown && !markdownPreviewLoading">
<div v-if="referencedCommands" class="referenced-commands" v-html="referencedCommands"></div> <div v-if="referencedCommands" class="referenced-commands" v-html="referencedCommands"></div>
<div v-if="shouldShowReferencedUsers" class="referenced-users"> <div v-if="shouldShowReferencedUsers" class="referenced-users">
......
---
title: Remove unnecessary div from MarkdownField to apply list styles correctly
merge_request: 23733
author:
type: fixed
...@@ -3919,6 +3919,9 @@ msgstr "" ...@@ -3919,6 +3919,9 @@ msgstr ""
msgid "Loading..." msgid "Loading..."
msgstr "" msgstr ""
msgid "Loading…"
msgstr ""
msgid "Lock" msgid "Lock"
msgstr "" msgstr ""
......
...@@ -80,7 +80,7 @@ describe('Markdown field component', () => { ...@@ -80,7 +80,7 @@ describe('Markdown field component', () => {
previewLink.click(); previewLink.click();
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.md-preview').textContent.trim()).toContain('Loading...'); expect(vm.$el.querySelector('.md-preview').textContent.trim()).toContain('Loading');
done(); done();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment