Skip to content

Commit

Permalink
fix: print should work in build mode when download is on (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
kermanx authored May 28, 2024
1 parent 4b7a611 commit 9b3beb4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/client/setup/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function setupRoutes() {
)
}

if (__SLIDEV_HAS_SERVER__) {
if (__SLIDEV_FEATURE_PRINT__) {
routes.push(
{
name: 'print',
Expand Down
1 change: 1 addition & 0 deletions packages/slidev/node/vite/extendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export function getDefine(options: ResolvedSlidevOptions): Record<string, string
__SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
__SLIDEV_FEATURE_RECORD__: JSON.stringify(options.data.config.record === true || options.data.config.record === options.mode),
__SLIDEV_FEATURE_PRESENTER__: JSON.stringify(options.data.config.presenter === true || options.data.config.presenter === options.mode),
__SLIDEV_FEATURE_PRINT__: JSON.stringify(options.mode === 'export' || (options.mode === 'build' && [true, 'true', 'auto'].includes(options.data.config.download))),
__SLIDEV_HAS_SERVER__: options.mode !== 'build' ? 'true' : 'false',
}
}
2 changes: 2 additions & 0 deletions shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare global {
const __SLIDEV_FEATURE_EDITOR__: boolean
const __SLIDEV_FEATURE_RECORD__: boolean
const __SLIDEV_FEATURE_PRESENTER__: boolean
const __SLIDEV_FEATURE_PRINT__: boolean
const __SLIDEV_HAS_SERVER__: boolean
}

Expand All @@ -21,6 +22,7 @@ declare module '@vue/runtime-core' {
__SLIDEV_FEATURE_EDITOR__: boolean
__SLIDEV_FEATURE_RECORD__: boolean
__SLIDEV_FEATURE_PRESENTER__: boolean
__SLIDEV_FEATURE_PRINT__: boolean
__SLIDEV_HAS_SERVER__: boolean
}
}

0 comments on commit 9b3beb4

Please sign in to comment.