Skip to content

Commit

Permalink
fix: print mode (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX authored Mar 13, 2024
1 parent f36fd71 commit c385495
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion packages/client/composables/useClicks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function createClicksContextBase(
export function createFixedClicks(
route?: SlideRoute | undefined,
currentInit = 0,
isDisabled?: () => boolean,
): ClicksContext {
return createClicksContextBase(ref(currentInit), route?.meta?.clicks)
return createClicksContextBase(ref(currentInit), route?.meta?.clicks, isDisabled)
}
5 changes: 3 additions & 2 deletions packages/client/internals/PrintSlide.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import type { SlideRoute } from '@slidev/types'
import { useFixedNav } from '../composables/useNav'
import { useFixedNav, useNav } from '../composables/useNav'
import { createFixedClicks } from '../composables/useClicks'
import PrintSlideClick from './PrintSlideClick.vue'
const { route } = defineProps<{ route: SlideRoute }>()
const clicks0 = createFixedClicks(route, 0)
const { isPrintWithClicks } = useNav()
const clicks0 = createFixedClicks(route, 0, () => !isPrintWithClicks.value)
</script>

<template>
Expand Down
16 changes: 5 additions & 11 deletions packages/client/modules/v-mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export function createVMarkDirective() {

const resolvedClick = resolveClick(el, binding, options.value.at)
if (!resolvedClick) {
console.error('[Slidev] Invalid value for v-mark:', options.value.at)
// No click animation, just show the mark
annotation.show()
return
}

Expand All @@ -130,19 +131,12 @@ export function createVMarkDirective() {

const at = options.value.at

if (at === true) {
if (at === true)
shouldShow = true
}
else if (at === false) {
else if (at === false)
shouldShow = false
}
else if (resolvedClick) {
else
shouldShow = resolvedClick.isActive.value
}
else {
console.error('[Slidev] Invalid value for v-mark:', at)
return
}

if (shouldShow == null)
return
Expand Down

0 comments on commit c385495

Please sign in to comment.