Skip to content

Commit

Permalink
fix: use provided range when exporting (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
twitwi committed Dec 16, 2022
1 parent 1ddcf6e commit e65d6d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/client/internals/PrintContainer.vue
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { parseRangeString } from '@slidev/parser/core'
import { computed, provide } from 'vue'
import { configs, slideAspect, slideWidth } from '../env'
import { injectionSlideScale } from '../constants'
import { rawRoutes } from '../logic/nav'
import { rawRoutes, route } from '../logic/nav'
import PrintSlide from './PrintSlide.vue'
const props = defineProps<{
Expand All @@ -21,7 +22,11 @@ const scale = computed(() => {
})
// Remove the "end" slide
const routes = rawRoutes.slice(0, -1)
let routes = rawRoutes.slice(0, -1)
if (route.value.query.range) {
const r = parseRangeString(routes.length, route.value.query.range)
routes = r.map(i => routes[i - 1])
}
const className = computed(() => ({
'select-none': !configs.selectable,
Expand Down
2 changes: 1 addition & 1 deletion packages/slidev/node/export.ts
Expand Up @@ -182,7 +182,7 @@ export async function exportSlides({
const progress = createSlidevProgress(true)

async function go(no: number | string, clicks?: string) {
const path = `${no}?print${withClicks ? '=clicks' : ''}${clicks ? `&clicks=${clicks}` : ''}`
const path = `${no}?print${withClicks ? '=clicks' : ''}${clicks ? `&clicks=${clicks}` : ''}${range ? `&range=${range}` : ''}`
const url = routerMode === 'hash'
? `http://localhost:${port}${base}#${path}`
: `http://localhost:${port}${base}${path}`
Expand Down

0 comments on commit e65d6d7

Please sign in to comment.