Merge pull request #406 from sharelatex/pr-expandable-text-area-fixes

Expandable text area fixes
This commit is contained in:
James Allen 2017-02-07 09:04:10 +01:00 committed by GitHub
commit 1b06af766d
3 changed files with 12 additions and 5 deletions

View file

@ -5,12 +5,13 @@ define [
restrict: "A" restrict: "A"
link: (scope, el) -> link: (scope, el) ->
resetHeight = () -> resetHeight = () ->
el.css("height", "auto") curHeight = el.outerHeight()
el.css("height", el.prop("scrollHeight")) fitHeight = el.prop("scrollHeight")
if fitHeight > curHeight and el.val() != ""
scope.$emit "expandable-text-area:resize"
el.css("height", fitHeight)
scope.$watch (() -> el.val()), resetHeight scope.$watch (() -> el.val()), resetHeight
resetHeight()

View file

@ -33,6 +33,10 @@ define [
$scope.$on "layout:pdf:resize", (event, state) -> $scope.$on "layout:pdf:resize", (event, state) ->
$scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed) $scope.reviewPanel.layoutToLeft = (state.east?.size < 220 || state.east?.initClosed)
$scope.$on "expandable-text-area:resize", (event) ->
$timeout () ->
$scope.$broadcast "review-panel:layout"
$scope.$watch "ui.pdfLayout", (layout) -> $scope.$watch "ui.pdfLayout", (layout) ->
$scope.reviewPanel.layoutToLeft = (layout == "flat") $scope.reviewPanel.layoutToLeft = (layout == "flat")

View file

@ -451,6 +451,8 @@
resize: vertical; resize: vertical;
color: @rp-type-darkgrey; color: @rp-type-darkgrey;
margin-top: 3px; margin-top: 3px;
overflow-x: hidden;
min-height: 3em;
} }
.rp-icon-delete { .rp-icon-delete {