🌐 AI搜索 & 代理 主页
Skip to content

Commit 0cfe057

Browse files
committed
Update form-textarea.js
1 parent 4ef1945 commit 0cfe057

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/components/form-textarea/form-textarea.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,27 @@ export const BFormTextarea = /*#__PURE__*/ Vue.extend({
6565
resize: !this.computedRows || this.noResize ? 'none' : null
6666
}
6767
if (!this.computedRows) {
68-
// Conditionaly set the computed CSS height when auto rows/height is enabled.
69-
// We avoid setting the style to null, which can override user manual resize handle.
68+
// Conditionally set the computed CSS height when auto rows/height is enabled
69+
// We avoid setting the style to `null`, which can override user manual resize handle
7070
styles.height = this.heightInPx
7171
// We always add a vertical scrollbar to the textarea when auto-height is
72-
// enabled so that the computed height calcaultion returns a stable value.
72+
// enabled so that the computed height calculation returns a stable value
7373
styles.overflowY = 'scroll'
7474
}
7575
return styles
7676
},
7777
computedMinRows() {
78-
// Ensure rows is at least 2 and positive (2 is the native textarea value).
79-
// A value of 1 can cause issues in some browsers, and most browsers only support
80-
// 2 as the smallest value.
78+
// Ensure rows is at least 2 and positive (2 is the native textarea value)
79+
// A value of 1 can cause issues in some browsers, and most browsers
80+
// only support 2 as the smallest value
8181
return Math.max(parseInt(this.rows, 10) || 2, 2)
8282
},
8383
computedMaxRows() {
8484
return Math.max(this.computedMinRows, parseInt(this.maxRows, 10) || 0)
8585
},
8686
computedRows() {
87-
// This is used to set the attribute 'rows' on the textarea.
88-
// If auto-height is enabled, then we return null as we use CSS to control height.
87+
// This is used to set the attribute 'rows' on the textarea
88+
// If auto-height is enabled, then we return `null` as we use CSS to control height
8989
return this.computedMinRows === this.computedMaxRows ? this.computedMinRows : null
9090
}
9191
},
@@ -98,10 +98,10 @@ export const BFormTextarea = /*#__PURE__*/ Vue.extend({
9898
this.setHeight()
9999
},
100100
methods: {
101+
// Called by intersection observer directive
101102
visibleCallback(visible) /* istanbul ignore next */ {
102-
// Called by intersection observer directive
103103
if (visible) {
104-
// We use a nextTick here jsut to make sure any
104+
// We use a `$nextTick()` here just to make sure any
105105
// transitions or portalling have completed
106106
this.$nextTick(this.setHeight)
107107
}
@@ -120,7 +120,7 @@ export const BFormTextarea = /*#__PURE__*/ Vue.extend({
120120

121121
const el = this.$el
122122

123-
// Element must be visible (not hidden) and in document.
123+
// Element must be visible (not hidden) and in document
124124
// Must be checked after above checks
125125
if (!isVisible(el)) {
126126
return null
@@ -146,18 +146,18 @@ export const BFormTextarea = /*#__PURE__*/ Vue.extend({
146146
// Probe scrollHeight by temporarily changing the height to `auto`
147147
el.style.height = 'auto'
148148
const scrollHeight = el.scrollHeight
149-
// Place the original old height back on the element, just in case this computedProp
150-
// returns the same value as before.
149+
// Place the original old height back on the element, just in case `computedProp`
150+
// returns the same value as before
151151
el.style.height = oldHeight
152152

153-
// Calculate content height in "rows" (scrollHeight includes padding but not border)
153+
// Calculate content height in 'rows' (scrollHeight includes padding but not border)
154154
const contentRows = Math.max((scrollHeight - padding) / lineHeight, 2)
155155
// Calculate number of rows to display (limited within min/max rows)
156156
const rows = Math.min(Math.max(contentRows, this.computedMinRows), this.computedMaxRows)
157157
// Calculate the required height of the textarea including border and padding (in pixels)
158158
const height = Math.max(Math.ceil(rows * lineHeight + offset), minHeight)
159159

160-
// Computed height remains the larger of oldHeight and new height,
160+
// Computed height remains the larger of `oldHeight` and new `height`,
161161
// when height is in `sticky` mode (prop `no-auto-shrink` is true)
162162
if (this.noAutoShrink && (parseFloat(oldHeight) || 0) > height) {
163163
return oldHeight

0 commit comments

Comments
 (0)