@slidev/client 0.43.10 → 0.43.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { useHead } from '@vueuse/head'
3
- import { computed } from 'vue'
3
+ import { computed, ref, watch } from 'vue'
4
4
  import { useLocalStorage } from '@vueuse/core'
5
5
  import { configs } from '../env'
6
6
  import { sharedState } from '../state/shared'
@@ -17,10 +17,16 @@ useHead({
17
17
 
18
18
  const { isFullscreen, toggle: toggleFullscreen } = fullscreen
19
19
 
20
+ const scroller = ref<HTMLDivElement>()
20
21
  const fontSize = useLocalStorage('slidev-notes-font-size', 18)
21
22
  const pageNo = computed(() => sharedState.lastUpdate?.type === 'viewer' ? sharedState.viewerPage : sharedState.page)
22
23
  const currentRoute = computed(() => rawRoutes.find(i => i.path === `${pageNo.value}`))
23
24
 
25
+ watch(pageNo, () => {
26
+ scroller.value?.scrollTo({ left: 0, top: 0, behavior: 'smooth' })
27
+ window.scrollTo({ left: 0, top: 0, behavior: 'smooth' })
28
+ })
29
+
24
30
  function increaseFontSize() {
25
31
  fontSize.value = fontSize.value + 1
26
32
  }
@@ -37,6 +43,7 @@ function decreaseFontSize() {
37
43
  />
38
44
  <div class="h-full flex flex-col">
39
45
  <div
46
+ ref="scroller"
40
47
  class="px-5 flex-auto h-full overflow-auto"
41
48
  :style="{ fontSize: `${fontSize}px` }"
42
49
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/client",
3
- "version": "0.43.10",
3
+ "version": "0.43.11",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  "vue-router": "^4.2.5",
46
46
  "vue-starport": "^0.4.0",
47
47
  "windicss": "^3.5.6",
48
- "@slidev/parser": "0.43.10",
49
- "@slidev/types": "0.43.10"
48
+ "@slidev/parser": "0.43.11",
49
+ "@slidev/types": "0.43.11"
50
50
  },
51
51
  "devDependencies": {
52
52
  "vite": "^4.5.0"