mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add comment replies via enter keypress.
This commit is contained in:
parent
78e409593b
commit
6c5c1549b6
3 changed files with 44 additions and 15 deletions
|
@ -72,10 +72,10 @@ div.full-size(
|
|||
p.rp-entry-metadata-line {{ entry.metadata.ts | date : 'MMM d, y h:mm a' }}
|
||||
.rp-avatar(style="background-color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%);") {{ users[entry.metadata.user_id].avatar_text }}
|
||||
.rp-entry-body(ng-switch="entry.type")
|
||||
span(ng-switch-when="insert") Added
|
||||
span.rp-content-highlight {{ entry.content }}
|
||||
span(ng-switch-when="delete") Delete
|
||||
span.rp-content-highlight {{ entry.content }}
|
||||
span(ng-switch-when="insert") Added
|
||||
ins.rp-content-highlight {{ entry.content }}
|
||||
span(ng-switch-when="delete") Delete
|
||||
del.rp-content-highlight {{ entry.content }}
|
||||
.rp-entry-actions
|
||||
a.rp-entry-button(href, ng-click="acceptChange(entry_id)")
|
||||
i.fa.fa-check
|
||||
|
@ -92,16 +92,22 @@ div.full-size(
|
|||
| •
|
||||
span(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 50%);") {{ users[comment.user_id].name }}
|
||||
.rp-avatar(style="background-color: hsl({{ users[comment.user_id].hue }}, 70%, 50%);") {{ users[comment.user_id].avatar_text }}
|
||||
//- div.small(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 50%)") {{ users[comment.user_id].name }}
|
||||
//- div.small {{ comment.ts }}
|
||||
//- | {{ comment.content }}
|
||||
//- pre {{ comment | json}}
|
||||
//- pre {{ users[comment.user_id] | json }}
|
||||
div(ng-if="entry.replying")
|
||||
textarea(ng-model="entry.replyContent")
|
||||
a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit
|
||||
a(href, ng-click="cancelReply(entry)") X
|
||||
a.btn.btn-sm.btn-primary(href, ng-click="startReply(entry)", ng-if="!entry.replying") Reply
|
||||
//- div.small(style="color: hsl({{ users[comment.user_id].hue }}, 70%, 50%)") {{ users[comment.user_id].name }}
|
||||
//- div.small {{ comment.ts }}
|
||||
//- | {{ comment.content }}
|
||||
//- pre {{ comment | json}}
|
||||
//- pre {{ users[comment.user_id] | json }}
|
||||
//- div(ng-if="entry.replying")
|
||||
//- textarea(ng-model="entry.replyContent")
|
||||
//- a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit
|
||||
//- a(href, ng-click="cancelReply(entry)") X
|
||||
//- a.btn.btn-sm.btn-primary(href, ng-click="startReply(entry)", ng-if="!entry.replying") Reply
|
||||
.rp-comment-reply
|
||||
textarea.rp-comment-reply-input(
|
||||
ng-model="entry.replyContent"
|
||||
ng-keypress="handleCommentReplyKeyPress($event, entry);"
|
||||
placeholder="Hit \"Enter\" to reply"
|
||||
)
|
||||
|
||||
.rp-entry-actions
|
||||
a.rp-entry-button(href)
|
||||
|
|
|
@ -85,7 +85,13 @@ define [
|
|||
$scope.startReply = (entry) ->
|
||||
entry.replying = true
|
||||
$scope.$broadcast "review-panel:layout"
|
||||
|
||||
|
||||
$scope.handleCommentReplyKeyPress = (ev, entry) ->
|
||||
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
||||
ev.preventDefault()
|
||||
ev.target.blur()
|
||||
$scope.submitReply(entry)
|
||||
|
||||
$scope.submitReply = (entry) ->
|
||||
entry.thread.push {
|
||||
content: entry.replyContent
|
||||
|
|
|
@ -113,6 +113,11 @@
|
|||
.rp-content-highlight {
|
||||
color: @rp-type-darkgrey;
|
||||
font-weight: @rp-semibold-weight;
|
||||
text-decoration: none;
|
||||
|
||||
.rp-entry-delete & {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
|
||||
.rp-entry-actions {
|
||||
|
@ -188,6 +193,18 @@
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
.rp-comment-reply {
|
||||
padding: 0 5px;
|
||||
}
|
||||
.rp-comment-reply-input {
|
||||
width: 100%;
|
||||
font-size: @rp-base-font-size;
|
||||
padding: 2px 5px;
|
||||
border-radius: 3px;
|
||||
border: solid 1px @rp-border-grey;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.rp-avatar {
|
||||
border-radius: 3px;
|
||||
font-weight: @rp-semibold-weight;
|
||||
|
|
Loading…
Reference in a new issue