From 15683370f0379360c475a9ad77bb802c43f6d181 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 8 Jul 2023 15:30:36 +0900
Subject: fix(frontend): ページ遷移でスクロール位置が保持されない問題を修正
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix #11068
---
 packages/frontend/src/ui/deck/main-column.vue | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'packages/frontend/src/ui/deck/main-column.vue')

diff --git a/packages/frontend/src/ui/deck/main-column.vue b/packages/frontend/src/ui/deck/main-column.vue
index 169fac70a2..0413307955 100644
--- a/packages/frontend/src/ui/deck/main-column.vue
+++ b/packages/frontend/src/ui/deck/main-column.vue
@@ -7,24 +7,29 @@
 		</template>
 	</template>
 
-	<RouterView @contextmenu.stop="onContextmenu"/>
+	<div ref="contents">
+		<RouterView @contextmenu.stop="onContextmenu"/>
+	</div>
 </XColumn>
 </template>
 
 <script lang="ts" setup>
-import { ComputedRef, provide } from 'vue';
+import { ComputedRef, provide, shallowRef } from 'vue';
 import XColumn from './column.vue';
 import { deckStore, Column } from '@/ui/deck/deck-store';
 import * as os from '@/os';
 import { i18n } from '@/i18n';
 import { mainRouter } from '@/router';
 import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
+import { useScrollPositionManager } from '@/nirax';
+import { getScrollContainer } from '@/scripts/scroll';
 
 defineProps<{
 	column: Column;
 	isStacked: boolean;
 }>();
 
+const contents = shallowRef<HTMLElement>();
 let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
 
 provide('router', mainRouter);
@@ -61,4 +66,6 @@ function onContextmenu(ev: MouseEvent) {
 		},
 	}], ev);
 }
+
+useScrollPositionManager(() => getScrollContainer(contents.value), mainRouter);
 </script>
-- 
cgit v1.2.3-freya

