mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 12:41:46 +00:00
Add expandable text area directive; apply it to review panel text areas.
This commit is contained in:
parent
59c40ea5cc
commit
a924794a5a
3 changed files with 21 additions and 0 deletions
|
@ -193,6 +193,7 @@ script(type='text/ng-template', id='commentEntryTemplate')
|
|||
) {{ comment.user.name }}:
|
||||
| {{ comment.content }}
|
||||
textarea.rp-comment-input(
|
||||
expandable-text-area
|
||||
ng-if="comment.editing"
|
||||
ng-model="comment.content"
|
||||
ng-keypress="saveEditOnEnter($event, comment);"
|
||||
|
@ -219,6 +220,7 @@ script(type='text/ng-template', id='commentEntryTemplate')
|
|||
i.fa.fa-spinner.fa-spin
|
||||
.rp-comment-reply(ng-if="permissions.comment")
|
||||
textarea.rp-comment-input(
|
||||
expandable-text-area
|
||||
ng-model="entry.replyContent"
|
||||
ng-keypress="handleCommentReplyKeyPress($event);"
|
||||
stop-propagation="click"
|
||||
|
@ -309,6 +311,7 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
|
|||
div(ng-if="state.isAdding")
|
||||
.rp-new-comment
|
||||
textarea.rp-comment-input(
|
||||
expandable-text-area
|
||||
ng-model="state.content"
|
||||
ng-keypress="handleCommentKeyPress($event);"
|
||||
placeholder="Add your comment here"
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.directive "expandableTextArea", () ->
|
||||
restrict: "A"
|
||||
link: (scope, el) ->
|
||||
resetHeight = () ->
|
||||
console.log el.val()
|
||||
el.css("height", "auto")
|
||||
el.css("height", el.prop("scrollHeight"))
|
||||
|
||||
scope.$watch (() -> el.val()), resetHeight
|
||||
|
||||
resetHeight()
|
||||
|
||||
|
||||
|
|
@ -28,6 +28,7 @@ define [
|
|||
"directives/onEnter"
|
||||
"directives/stopPropagation"
|
||||
"directives/rightClick"
|
||||
"directives/expandableTextArea"
|
||||
"services/queued-http"
|
||||
"filters/formatDate"
|
||||
"main/event"
|
||||
|
|
Loading…
Reference in a new issue