ph-no-capture tags (#4579)

added no capture tags to stop posthog capturing recordings of pdf
content

---------

Co-authored-by: Connor Yoh <connor@stirlingpdf.com>
This commit is contained in:
ConnorYoh 2025-10-02 11:36:11 +01:00 committed by GitHub
parent 25154e4dbe
commit 06b4c147bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 31 additions and 21 deletions

View File

@ -324,7 +324,7 @@ const FileEditorThumbnail = ({
marginTop: '0.5rem', marginTop: '0.5rem',
marginBottom: '0.5rem', marginBottom: '0.5rem',
}}> }}>
<Text size="lg" fw={700} className={styles.title} lineClamp={2}> <Text size="lg" fw={700} className={`${styles.title} ph-no-capture `} lineClamp={2}>
{file.name} {file.name}
</Text> </Text>
<Text <Text
@ -350,6 +350,7 @@ const FileEditorThumbnail = ({
<div className={styles.previewPaper}> <div className={styles.previewPaper}>
{file.thumbnailUrl && ( {file.thumbnailUrl && (
<img <img
className="ph-no-capture"
src={file.thumbnailUrl} src={file.thumbnailUrl}
alt={file.name} alt={file.name}
draggable={false} draggable={false}

View File

@ -26,7 +26,7 @@ const FileInfoCard: React.FC<FileInfoCardProps> = ({
<ScrollArea style={{ flex: 1 }} p="md"> <ScrollArea style={{ flex: 1 }} p="md">
<Stack gap="sm"> <Stack gap="sm">
<Group justify="space-between" py="xs"> <Group justify="space-between" py="xs">
<Text size="sm" c="dimmed">{t('fileManager.fileName', 'Name')}</Text> <Text className='ph-no-capture' size="sm" c="dimmed">{t('fileManager.fileName', 'Name')}</Text>
<Text size="sm" fw={500} style={{ maxWidth: '60%', textAlign: 'right' }} truncate> <Text size="sm" fw={500} style={{ maxWidth: '60%', textAlign: 'right' }} truncate>
{currentFile ? currentFile.name : ''} {currentFile ? currentFile.name : ''}
</Text> </Text>

View File

@ -93,7 +93,7 @@ const FileListItem: React.FC<FileListItemProps> = ({
<Box style={{ flex: 1, minWidth: 0 }}> <Box style={{ flex: 1, minWidth: 0 }}>
<Group gap="xs" align="center"> <Group gap="xs" align="center">
<Text size="sm" fw={500} truncate style={{ flex: 1 }}>{file.name}</Text> <Text size="sm" fw={500} className='ph-no-capture' truncate style={{ flex: 1 }}>{file.name}</Text>
<Badge size="xs" variant="light" color={"blue"}> <Badge size="xs" variant="light" color={"blue"}>
v{currentVersion} v{currentVersion}
</Badge> </Badge>

View File

@ -317,6 +317,7 @@ const FileThumbnail = ({
> >
{file.thumbnail && ( {file.thumbnail && (
<img <img
className="ph-no-capture"
src={file.thumbnail} src={file.thumbnail}
alt={file.name} alt={file.name}
draggable={false} draggable={false}

View File

@ -371,6 +371,7 @@ const PageThumbnail: React.FC<PageThumbnailProps> = ({
</div> </div>
) : thumbnailUrl ? ( ) : thumbnailUrl ? (
<img <img
className="ph-no-capture"
src={thumbnailUrl} src={thumbnailUrl}
alt={`Page ${page.pageNumber}`} alt={`Page ${page.pageNumber}`}
draggable={false} draggable={false}

View File

@ -19,7 +19,7 @@ const DocumentThumbnail: React.FC<DocumentThumbnailProps> = ({
children children
}) => { }) => {
if (!file) return null; if (!file) return null;
const containerStyle = { const containerStyle = {
position: 'relative' as const, position: 'relative' as const,
cursor: onClick ? 'pointer' : 'default', cursor: onClick ? 'pointer' : 'default',
@ -36,6 +36,7 @@ const DocumentThumbnail: React.FC<DocumentThumbnailProps> = ({
return ( return (
<Box style={containerStyle} onClick={onClick}> <Box style={containerStyle} onClick={onClick}>
<Image <Image
className='ph-no-capture'
src={thumbnail} src={thumbnail}
alt={`Preview of ${file.name}`} alt={`Preview of ${file.name}`}
fit="contain" fit="contain"
@ -49,11 +50,12 @@ const DocumentThumbnail: React.FC<DocumentThumbnailProps> = ({
return ( return (
<Box style={containerStyle} onClick={onClick}> <Box style={containerStyle} onClick={onClick}>
<Center style={{ width: '100%', height: '100%', backgroundColor: 'var(--mantine-color-gray-1)', borderRadius: '0.25rem' }}> <Center style={{ width: '100%', height: '100%', backgroundColor: 'var(--mantine-color-gray-1)', borderRadius: '0.25rem' }}>
<PictureAsPdfIcon <PictureAsPdfIcon
style={{ className='ph-no-capture'
fontSize: '2rem', style={{
color: 'var(--mantine-color-gray-6)' fontSize: '2rem',
}} color: 'var(--mantine-color-gray-6)'
}}
/> />
</Center> </Center>
{children} {children}
@ -61,4 +63,4 @@ const DocumentThumbnail: React.FC<DocumentThumbnailProps> = ({
); );
}; };
export default DocumentThumbnail; export default DocumentThumbnail;

View File

@ -200,7 +200,7 @@ export default function PageNumberPreview({ parameters, onParameterChange, file,
<img <img
src={pageThumbnail} src={pageThumbnail}
alt="page preview" alt="page preview"
className={styles.pageThumbnail} className={`${styles.pageThumbnail} ph-no-capture`}
draggable={false} draggable={false}
/> />
)} )}
@ -238,4 +238,4 @@ export default function PageNumberPreview({ parameters, onParameterChange, file,
</div> </div>
</div> </div>
); );
} }

View File

@ -62,6 +62,7 @@ const ResultsPreview = ({
{/* File name at the top */} {/* File name at the top */}
<Box mb="sm" style={{ minHeight: '3rem', display: 'flex', alignItems: 'flex-start' }}> <Box mb="sm" style={{ minHeight: '3rem', display: 'flex', alignItems: 'flex-start' }}>
<Text <Text
className='ph-no-capture'
size="sm" size="sm"
fw={500} fw={500}
style={{ style={{

View File

@ -182,14 +182,17 @@ export function LocalEmbedPDF({ file, url, enableAnnotations = false, onSignatur
// Wrap your UI with the <EmbedPDF> provider // Wrap your UI with the <EmbedPDF> provider
return ( return (
<div style={{ <div
height: '100%', className='ph-no-capture'
width: '100%',
position: 'relative', style={{
overflow: 'hidden', height: '100%',
flex: 1, width: '100%',
minHeight: 0, position: 'relative',
minWidth: 0 overflow: 'hidden',
flex: 1,
minHeight: 0,
minWidth: 0,
}}> }}>
<EmbedPDF <EmbedPDF
engine={engine} engine={engine}
@ -310,7 +313,7 @@ export function LocalEmbedPDF({ file, url, enableAnnotations = false, onSignatur
<CustomSearchLayer pageIndex={pageIndex} scale={scale} /> <CustomSearchLayer pageIndex={pageIndex} scale={scale} />
{/* Selection layer for text interaction */} {/* Selection layer for text interaction */}
<SelectionLayer pageIndex={pageIndex} scale={scale} /> <SelectionLayer pageIndex={pageIndex} scale={scale} />
{/* Annotation layer for signatures (only when enabled) */} {/* Annotation layer for signatures (only when enabled) */}
{enableAnnotations && ( {enableAnnotations && (
<AnnotationLayer <AnnotationLayer

View File

@ -134,6 +134,7 @@ export function ThumbnailSidebar({ visible, onToggle: _onToggle }: ThumbnailSide
{/* Thumbnail Image */} {/* Thumbnail Image */}
{thumbnails[pageIndex] && thumbnails[pageIndex] !== 'error' ? ( {thumbnails[pageIndex] && thumbnails[pageIndex] !== 'error' ? (
<img <img
className='ph-no-capture'
src={thumbnails[pageIndex]} src={thumbnails[pageIndex]}
alt={`Page ${pageIndex + 1} thumbnail`} alt={`Page ${pageIndex + 1} thumbnail`}
style={{ style={{