From 0f92353bd99bb605b526e3de314dc4167528d772 Mon Sep 17 00:00:00 2001 From: balibabu Date: Mon, 25 May 2026 17:21:36 +0800 Subject: [PATCH] Fix: Replace the red highlight at the top of the PDF document with yellow. (#15203) ### What problem does this PR solve? Fix: Replace the red highlight at the top of the PDF document with yellow. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../components/document-preview/index.module.less | 13 ------------- web/src/components/document-preview/index.tsx | 6 +++--- web/src/components/document-preview/pdf-preview.tsx | 4 ++-- web/src/global.less | 4 ++++ 4 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 web/src/components/document-preview/index.module.less diff --git a/web/src/components/document-preview/index.module.less b/web/src/components/document-preview/index.module.less deleted file mode 100644 index 8f456af5a9..0000000000 --- a/web/src/components/document-preview/index.module.less +++ /dev/null @@ -1,13 +0,0 @@ -.documentContainer { - width: 100%; - // height: calc(100vh - 284px); - height: calc(100vh - 180px); - position: relative; - :global(.PdfHighlighter) { - overflow-x: hidden; - } - :global(.Highlight--scrolledTo .Highlight__part) { - overflow-x: hidden; - background-color: rgba(255, 226, 143, 1); - } -} diff --git a/web/src/components/document-preview/index.tsx b/web/src/components/document-preview/index.tsx index 9e31111d30..37889833c8 100644 --- a/web/src/components/document-preview/index.tsx +++ b/web/src/components/document-preview/index.tsx @@ -15,13 +15,13 @@ type PreviewProps = { className?: string; url: string; }; -const Preview = ({ +const DocumentPreview = function ({ fileType, className, highlights, setWidthAndHeight, url, -}: PreviewProps & Partial) => { +}: PreviewProps & Partial) { return ( <> {fileType === 'pdf' && highlights && setWidthAndHeight && ( @@ -91,4 +91,4 @@ const Preview = ({ ); }; -export default memo(Preview); +export default memo(DocumentPreview); diff --git a/web/src/components/document-preview/pdf-preview.tsx b/web/src/components/document-preview/pdf-preview.tsx index ae6699b5b8..7c48ea0325 100644 --- a/web/src/components/document-preview/pdf-preview.tsx +++ b/web/src/components/document-preview/pdf-preview.tsx @@ -112,8 +112,8 @@ const PdfPreview = ({ screenshot, isScrolledTo, ) => { - const isTextHighlight = !Boolean( - highlight.content && highlight.content.image, + const isTextHighlight = !( + highlight.content && highlight.content.image ); const component = isTextHighlight ? ( diff --git a/web/src/global.less b/web/src/global.less index ddf5a1d893..4787072542 100644 --- a/web/src/global.less +++ b/web/src/global.less @@ -48,3 +48,7 @@ body, ::-webkit-scrollbar-thumb:hover { background: #888; } + +.Highlight--scrolledTo .Highlight__part { + background: #ffe28f !important; +}