Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
e932abfa
Commit
e932abfa
authored
Oct 15, 2019
by
tleb
Browse files
Prevent pressing submit if the Markdown widget is empty
parent
0011f4c7
Pipeline
#2095
passed with stage
in 34 minutes and 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/templates/core/markdown_textarea.jinja
View file @
e932abfa
...
...
@@ -175,24 +175,25 @@
let
parentDiv
=
textarea
.
parentElement
let
submitPressed
=
false
function
checkMarkdownInput
()
{
function
checkMarkdownInput
(
e
)
{
// an attribute is null if it does not exist, else a string
let
required
=
textarea
.
getAttribute
(
'
required
'
)
!=
null
let
length
=
textarea
.
value
.
trim
().
length
if
(
required
&&
length
==
0
)
{
parentDiv
.
style
.
boxShadow
=
'
red 0px 0px 1.5px 1px
'
e
.
preventDefault
()
}
else
{
parentDiv
.
style
.
boxShadow
=
''
}
}
submit
.
addEventListener
(
'
click
'
,
()
=>
{
submit
.
addEventListener
(
'
click
'
,
(
e
)
=>
{
if
(
!
submitPressed
)
{
easymde
.
codemirror
.
on
(
'
change
'
,
checkMarkdownInput
)
}
submitPressed
=
true
checkMarkdownInput
()
checkMarkdownInput
(
e
)
})
})
</script>
...
...
Write
Preview
Supports
Markdown
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