Skip to content

Commit

Permalink
fix: fixed user conversations disappearing when exporting screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
lsby authored and pionxzh committed Feb 2, 2025
1 parent eccd564 commit eaf7c76
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/exporter/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,21 @@ export async function exportToPng(fileNameFormat: string) {
})
}

// hide buttons
const buttonWrappers = document.querySelectorAll<HTMLDivElement>('main .flex.empty\\:hidden')
buttonWrappers.forEach((wrapper) => {
if (!wrapper.querySelector('button')) return
// ignore codeblock
if (wrapper.closest('pre')) return

// hide switch context button
const switchContextBuuton1 = thread.querySelectorAll('div.mb-2.flex.gap-3.empty\\:hidden.mr-1.flex-row-reverse')
if (switchContextBuuton1) {
effect.add(() => {
wrapper.style.display = 'none'
return () => wrapper.style.display = ''
switchContextBuuton1.forEach(a => a.classList.add('hidden'))
return () => switchContextBuuton1.forEach(a => a.classList.remove('hidden'))
})
})
}
const switchContextBuuton2 = thread.querySelectorAll('div.mb-2.flex.gap-3.empty\\:hidden.-ml-2')
if (switchContextBuuton2) {
effect.add(() => {
switchContextBuuton2.forEach(a => a.classList.add('hidden'))
return () => switchContextBuuton2.forEach(a => a.classList.remove('hidden'))
})
}

// hide code block copy button
const copyButtons = thread.querySelectorAll('pre button')
Expand Down

0 comments on commit eaf7c76

Please sign in to comment.