mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Avoid empty comment submission.
This commit is contained in:
parent
121629426e
commit
36f15ff56e
3 changed files with 13 additions and 6 deletions
|
@ -204,7 +204,8 @@ script(type='text/ng-template', id='commentEntryTemplate')
|
|||
button.rp-entry-button(
|
||||
ng-click="onReply();"
|
||||
ng-if="permissions.comment"
|
||||
ng-disabled="!entry.replyContent.length")
|
||||
ng-disabled="!entry.replyContent.length"
|
||||
)
|
||||
i.fa.fa-reply
|
||||
| Reply
|
||||
|
||||
|
@ -284,10 +285,15 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
|
|||
focus-on="comment:new:open"
|
||||
)
|
||||
.rp-entry-actions
|
||||
a.rp-entry-button(href, ng-click="cancelNewComment();")
|
||||
button.rp-entry-button(
|
||||
ng-click="cancelNewComment();"
|
||||
)
|
||||
i.fa.fa-times
|
||||
| Cancel
|
||||
a.rp-entry-button(href, ng-click="submitNewComment()")
|
||||
button.rp-entry-button(
|
||||
ng-click="submitNewComment()"
|
||||
ng-disabled="!state.content.length"
|
||||
)
|
||||
i.fa.fa-comment
|
||||
| Comment
|
||||
|
||||
|
|
|
@ -27,8 +27,9 @@ define [
|
|||
scope.handleCommentKeyPress = (ev) ->
|
||||
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
||||
ev.preventDefault()
|
||||
ev.target.blur()
|
||||
scope.submitNewComment()
|
||||
if scope.state.content.length > 0
|
||||
ev.target.blur()
|
||||
scope.submitNewComment()
|
||||
|
||||
scope.submitNewComment = () ->
|
||||
scope.onSubmit { content: scope.state.content }
|
||||
|
|
|
@ -18,7 +18,7 @@ define [
|
|||
scope.handleCommentReplyKeyPress = (ev) ->
|
||||
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
||||
ev.preventDefault()
|
||||
if scope.entry.length > 0
|
||||
if scope.entry.replyContent.length > 0
|
||||
ev.target.blur()
|
||||
scope.onReply()
|
||||
|
||||
|
|
Loading…
Reference in a new issue