Skip to content

Commit

Permalink
fix: conditional auto scroll for notes
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 26, 2024
1 parent c5a5fdd commit 0b2450c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/client/internals/NoteDisplay.vue
Expand Up @@ -9,6 +9,7 @@ const props = defineProps<{
note?: string
placeholder?: string
clicksContext?: ClicksContext
autoScroll?: boolean
}>()
defineEmits(['click'])
Expand Down Expand Up @@ -97,7 +98,7 @@ function highlightNote() {
e.stopImmediatePropagation()
})
if (clicks === current)
if (props.autoScroll && clicks === current)
marker.scrollIntoView({ block: 'center', behavior: 'smooth' })
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/client/internals/NoteEditor.vue
Expand Up @@ -106,6 +106,7 @@ watch(
:note="note || placeholder"
:note-html="info?.noteHTML"
:clicks-context="clicksContext"
:auto-scroll="!autoHeight"
/>
<textarea
v-else
Expand Down
1 change: 1 addition & 0 deletions packages/client/pages/notes.vue
Expand Up @@ -52,6 +52,7 @@ function decreaseFontSize() {
:note-html="currentRoute?.meta?.slide?.noteHTML"
:placeholder="`No notes for Slide ${pageNo}.`"
:clicks-context="currentRoute?.meta?.__clicksContext"
:auto-scroll="true"
/>
</div>
<div class="flex-none border-t border-main">
Expand Down
5 changes: 4 additions & 1 deletion packages/client/pages/presenter/print.vue
Expand Up @@ -56,7 +56,10 @@ const slidesWithNote = computed(() => rawRoutes
<div class="flex-auto" />
</div>
</h2>
<NoteDisplay :note-html="slide!.noteHTML" class="max-w-full" />
<NoteDisplay
:note-html="slide!.noteHTML"
class="max-w-full"
/>
</div>
<hr v-if="index < slidesWithNote.length - 1" class="border-main mb-8">
</div>
Expand Down

0 comments on commit 0b2450c

Please sign in to comment.