Skip to content

Commit 8de2d26

Browse files
julien-ncn-iv
authored andcommitted
fix: make NcRichText scroll while streaming in <TextInput>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 1a61c4b commit 8de2d26

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 ?? ''"
@@ -196,10 +197,16 @@ export default {
196197
if (!this.streaming()) {
197198
return
198199
}
199-
const scrollableArea = this.$refs.input?.$el?.querySelector('#' + this.id)
200-
if (scrollableArea) {
201-
scrollableArea.scrollTo(0, scrollableArea.scrollHeight)
202-
}
200+
this.$nextTick(() => {
201+
const scrollableArea = this.$refs.input?.$el?.querySelector('#' + this.id)
202+
if (scrollableArea) {
203+
scrollableArea.scrollTo(0, scrollableArea.scrollHeight)
204+
}
205+
const richText = this.$refs.richText?.$el
206+
if (richText) {
207+
richText.scrollTo(0, richText.scrollHeight)
208+
}
209+
})
203210
},
204211
},
205212

0 commit comments

Comments
 (0)