Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: print should work in build mode when download is on #1620

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading