From a4ab0066e12c656682e29a716b866d6ed3d36ccc Mon Sep 17 00:00:00 2001
From: Max <max@nextcloud.com>
Date: Mon, 7 Feb 2022 08:57:17 +0100
Subject: fix: scroll image into view once it has been loaded

Signed-off-by: Max <max@nextcloud.com>
---
 src/nodes/ImageView.vue | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/nodes/ImageView.vue')

diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue
index 5bada41e9..5d3887029 100644
--- a/src/nodes/ImageView.vue
+++ b/src/nodes/ImageView.vue
@@ -122,7 +122,7 @@ export default {
 	mixins: [
 		store,
 	],
-	props: ['node', 'extension', 'updateAttributes', 'getPos'], // eslint-disable-line
+	props: ['editor', 'node', 'extension', 'updateAttributes', 'getPos'], // eslint-disable-line
 	data() {
 		return {
 			imageLoaded: false,
@@ -292,6 +292,9 @@ export default {
 		},
 		onLoaded() {
 			this.loaded = true
+			this.$nextTick(() => {
+				this.editor.commands.scrollIntoView()
+			})
 		},
 		deleteImage() {
 			const tr = this.view.state.tr
-- 
cgit v1.2.3

