Skip to content

Commit

Permalink
Only scroll images into view when they're added
Browse files Browse the repository at this point in the history
Instead of scrolling each image into view after it's been loaded, only
scroll images into view when they got added to the document.

Fixes: #3531

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- authored and juliusknorr committed Dec 9, 2022
1 parent 3f5f30b commit 691a432
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ export default {
} else {
this.$editor.chain().setImage({ src, alt }).insertContent('<br />').focus().run()
}
// Scroll image into view
this.$editor.commands.scrollIntoView()
},
onOpened({ document, session }) {
Expand Down
3 changes: 0 additions & 3 deletions src/nodes/ImageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ export default {
},
onLoaded() {
this.loaded = true
this.$nextTick(() => {
this.editor.commands.scrollIntoView()
})
},
getTextApiUrl(imageFileName) {
const documentId = this.currentSession?.documentId
Expand Down

0 comments on commit 691a432

Please sign in to comment.