Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
fb642155
Commit
fb642155
authored
Aug 18, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty markdown render request.
parent
7e82e45d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
25 deletions
+29
-25
app/assets/javascripts/vue_shared/components/markdown/field.vue
...sets/javascripts/vue_shared/components/markdown/field.vue
+29
-25
No files found.
app/assets/javascripts/vue_shared/components/markdown/field.vue
View file @
fb642155
...
...
@@ -47,22 +47,29 @@
toggleMarkdownPreview
()
{
this
.
previewMarkdown
=
!
this
.
previewMarkdown
;
if
(
!
this
.
previewMarkdown
)
{
this
.
markdownPreview
=
''
;
}
else
{
this
.
markdownPreviewLoading
=
true
;
this
.
$http
.
post
(
this
.
markdownPreviewPath
,
{
/*
Can't use `$refs` as the component is technically in the parent component
so we access the VNode & then get the element
*/
text
:
this
.
$slots
.
textarea
[
0
].
elm
.
value
,
},
)
const
text
=
this
.
$slots
.
textarea
[
0
].
elm
.
value
;
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
{
this
.
renderMarkdown
();
}
}
},
renderMarkdown
(
data
=
{})
{
this
.
markdownPreviewLoading
=
false
;
this
.
markdownPreview
=
data
.
body
||
'
Nothing to preview.
'
;
...
...
@@ -74,9 +81,6 @@
this
.
$nextTick
(()
=>
{
$
(
this
.
$refs
[
'
markdown-preview
'
]).
renderGFM
();
});
})
.
catch
(()
=>
new
Flash
(
'
Error loading markdown preview
'
));
}
},
},
mounted
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment