Skip to content

Commit 3ea0caf

Browse files
committed
fix: make NcRichText scroll while streaming in <TextInput>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 742481f commit 3ea0caf

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/components/fields/TextInput.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</label>
1212
<NcRichText
1313
v-if="isOutput && hasValue && !isEditing"
14+
ref="richText"
1415
class="rendered-output output-wrapper"
1516
:title="t('assistant', 'Double-click to edit')"
1617
:text="value ?? ''"
@@ -178,10 +179,16 @@ export default {
178179
if (!this.streaming()) {
179180
return
180181
}
181-
const scrollableArea = this.$refs.input?.$el?.querySelector('#' + this.id)
182-
if (scrollableArea) {
183-
scrollableArea.scrollTo(0, scrollableArea.scrollHeight)
184-
}
182+
this.$nextTick(() => {
183+
const scrollableArea = this.$refs.input?.$el?.querySelector('#' + this.id)
184+
if (scrollableArea) {
185+
scrollableArea.scrollTo(0, scrollableArea.scrollHeight)
186+
}
187+
const richText = this.$refs.richText?.$el
188+
if (richText) {
189+
richText.scrollTo(0, richText.scrollHeight)
190+
}
191+
})
185192
},
186193
},
187194

0 commit comments

Comments
 (0)