kopia lustrzana https://github.com/shoelace-style/shoelace
add scrollPosition method
rodzic
9b21d5a619
commit
0dbb72efe9
|
@ -9,6 +9,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
|
|||
## Next
|
||||
|
||||
- Added `?` to optional arguments in methods tables
|
||||
- Added the `scrollPosition()` method to `sl-textarea` to get/set scroll position
|
||||
|
||||
## 2.0.0-beta.42
|
||||
|
||||
|
|
|
@ -162,6 +162,20 @@ export default class SlTextarea extends LitElement {
|
|||
return this.input.select();
|
||||
}
|
||||
|
||||
/** Gets or sets the textarea's scroll position. */
|
||||
scrollPosition(position?: { top?: number; left?: number }) {
|
||||
if (position) {
|
||||
if (typeof position.top === 'number') this.input.scrollTop = position.top;
|
||||
if (typeof position.left === 'number') this.input.scrollLeft = position.left;
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
top: this.input.scrollTop,
|
||||
left: this.input.scrollTop
|
||||
};
|
||||
}
|
||||
|
||||
/** Sets the start and end positions of the text selection (0-based). */
|
||||
setSelectionRange(
|
||||
selectionStart: number,
|
||||
|
|
Ładowanie…
Reference in New Issue