From 1a1320b561a8a13f33ea10d3864aac745b8c08e4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 11:59:55 +0000 Subject: [PATCH 1/3] Avoid shrinking the expandable text area. --- .../public/coffee/directives/expandableTextArea.coffee | 10 +++++----- .../public/stylesheets/app/editor/review-panel.less | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/web/public/coffee/directives/expandableTextArea.coffee b/services/web/public/coffee/directives/expandableTextArea.coffee index 8f646c10a7..58f8ce13ae 100644 --- a/services/web/public/coffee/directives/expandableTextArea.coffee +++ b/services/web/public/coffee/directives/expandableTextArea.coffee @@ -5,12 +5,12 @@ define [ restrict: "A" link: (scope, el) -> resetHeight = () -> - el.css("height", "auto") - el.css("height", el.prop("scrollHeight")) + curHeight = el.outerHeight() + fitHeight = el.prop("scrollHeight") + + if fitHeight > curHeight and el.val() != "" + el.css("height", fitHeight) scope.$watch (() -> el.val()), resetHeight - resetHeight() - - \ No newline at end of file diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index da9fa7eb43..86bdedfff1 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -451,6 +451,7 @@ resize: vertical; color: @rp-type-darkgrey; margin-top: 3px; + overflow-x: hidden; } .rp-icon-delete { From 6304c213bdce77ea6ae80ea93371c8df33d39013 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 12:00:11 +0000 Subject: [PATCH 2/3] Add a min-height to the review panel text areas. --- services/web/public/stylesheets/app/editor/review-panel.less | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index 86bdedfff1..1bac7faf6f 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -452,6 +452,7 @@ color: @rp-type-darkgrey; margin-top: 3px; overflow-x: hidden; + min-height: 3em; } .rp-icon-delete { From ce89714a48d9fa6e5ebbbb8626107d6fea1f44bd Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 26 Jan 2017 14:35:01 +0000 Subject: [PATCH 3/3] Emit event when textarea resizes; capture it in the review panel and trigger reflow. --- .../web/public/coffee/directives/expandableTextArea.coffee | 1 + .../ide/review-panel/controllers/ReviewPanelController.coffee | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/services/web/public/coffee/directives/expandableTextArea.coffee b/services/web/public/coffee/directives/expandableTextArea.coffee index 58f8ce13ae..d0bfa9cb99 100644 --- a/services/web/public/coffee/directives/expandableTextArea.coffee +++ b/services/web/public/coffee/directives/expandableTextArea.coffee @@ -9,6 +9,7 @@ define [ 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 diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index 5dc2cd3715..1a1a37cf21 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -33,6 +33,10 @@ define [ $scope.$on "layout:pdf:resize", (event, state) -> $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.reviewPanel.layoutToLeft = (layout == "flat")