Skip to content

Commit

Permalink
fix(Textarea): throw exception when js invoke (#2728)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang authored Jan 3, 2024
1 parent 3d4377f commit e274804
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/BootstrapBlazor/Components/Textarea/Textarea.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ export function init(id) {
export function execute(id, method, position) {
const text = Data.get(id)

const autoScroll = text.element.getAttribute('data-bb-scroll') === 'auto'
if (method === 'update') {
method = text.prevMethod
}
if (method === 'toTop') {
position = 0;
}
if (autoScroll || method === 'toBottom') {
position = text.element.scrollHeight
}
if (text) {
const autoScroll = text.element.getAttribute('data-bb-scroll') === 'auto'
if (method === 'update') {
method = text.prevMethod
}
if (method === 'toTop') {
position = 0;
}
if (autoScroll || method === 'toBottom') {
position = text.element.scrollHeight
}

if (!isNaN(position)) {
text.element.scrollTop = position;
}
if (!isNaN(position)) {
text.element.scrollTop = position;
}

if (method !== 'update') {
text.prevMethod = method;
if (method !== 'update') {
text.prevMethod = method;
}
}
}

Expand Down

0 comments on commit e274804

Please sign in to comment.