Skip to content

Commit 12f0fef

Browse files
committed
feat(demo): adding demo showcasting new top and bottom borders size support
1 parent c114086 commit 12f0fef

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-autosize-app",
3-
"version": "1.5.1",
3+
"version": "1.6.0",
44
"homepage": "https://chrum.it/pages/ngx-autosize",
55
"description": "Directive that automatically adjusts textarea height to fit content",
66
"repository": {

projects/autosize/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-autosize",
3-
"version": "1.5.1",
3+
"version": "1.6.0",
44
"homepage": "https://chrum.it/pages/ngx-autosize",
55
"description": "Directive that automatically adjusts textarea height to fit content",
66
"repository": {

projects/autosize/src/lib/autosize.directive.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ export class AutosizeDirective implements OnDestroy, OnChanges, AfterContentChec
132132
let height = clone.scrollHeight;
133133

134134
// add into height top and bottom borders' width
135-
let computedStyle = window.getComputedStyle(clone, null);
136-
height += parseInt(computedStyle.getPropertyValue('border-top-width')) + parseInt(computedStyle.getPropertyValue('border-bottom-width'));
137-
135+
let computedStyle = window.getComputedStyle(clone, null);
136+
height += parseInt(computedStyle.getPropertyValue('border-top-width'));
137+
height += parseInt(computedStyle.getPropertyValue('border-bottom-width'));
138+
138139
const willGrow = height > this.textAreaEl.offsetHeight;
139140

140141
if (this.onlyGrow === false || willGrow) {

src/app/app.component.html

+13
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,16 @@ <h3>
7373

7474
<hr/>
7575

76+
<div>
77+
<h3>Top and bottom borders <strong>15px</strong> of width</h3>
78+
<textarea autosize class="top-and-bottom-borders">1. Here this textarea
79+
2. should show all 4 lines
80+
3. as it respects top
81+
4. and bottom borders
82+
5. otherwise this fifth line would have been hidden</textarea>
83+
</div>
84+
85+
<hr/>
86+
87+
88+

src/app/app.component.scss

+5
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ textarea {
44
&.forceImportant {
55
height: auto !important
66
}
7+
8+
&.top-and-bottom-borders {
9+
border-top-width:15px;
10+
border-bottom-width:15px
11+
}
712
}

0 commit comments

Comments
 (0)