Fix PDF text selection in document viewer
- Added explicit z-index stacking order: - Text layer: z-index 2 (top, for selectable text) - Image overlays: z-index 1 (below text layer) - Image overlays on hover: z-index 20 (brings to front) - Enhanced text layer CSS with cross-browser support: - Added -webkit-user-select, -moz-user-select, -ms-user-select - Added pointer-events: auto to text layer spans - Ensures text is selectable on all browsers - Fixed image overlay z-index from 10 to 1 - Prevents blocking text selection - Images still clickable, but text layer takes precedence - Added user-select: auto to body and #app in main.css - Ensures text selection is enabled globally This fixes the issue where text was not selectable in the PDF viewer, especially for digitized/text-based PDFs. The PDF.js text layer now properly overlays the canvas and allows text selection while keeping image overlays interactive. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d03b10697c
commit
e0ae22cf63
3 changed files with 14 additions and 1 deletions
|
|
@ -13,12 +13,16 @@
|
|||
|
||||
body {
|
||||
@apply font-sans antialiased bg-black text-white;
|
||||
user-select: auto;
|
||||
-webkit-user-select: auto;
|
||||
}
|
||||
|
||||
/* Dark gradient background for app container */
|
||||
#app {
|
||||
background: linear-gradient(135deg, #1a0b2e 0%, #0a0118 50%, #000000 100%);
|
||||
min-height: 100vh;
|
||||
user-select: auto;
|
||||
-webkit-user-select: auto;
|
||||
}
|
||||
|
||||
/* Smooth scrolling */
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ const overlayStyle = computed(() => {
|
|||
width: `${width}px`,
|
||||
height: `${height}px`,
|
||||
cursor: 'pointer',
|
||||
zIndex: 10
|
||||
zIndex: 1
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -109,6 +109,7 @@ function handleClick(event) {
|
|||
.image-overlay {
|
||||
position: absolute;
|
||||
transition: all 0.2s ease;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.image-overlay:hover {
|
||||
|
|
|
|||
|
|
@ -451,6 +451,10 @@ onBeforeUnmount(() => {
|
|||
line-height: 1.0;
|
||||
pointer-events: auto;
|
||||
user-select: text;
|
||||
z-index: 2;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
}
|
||||
|
||||
.textLayer > span {
|
||||
|
|
@ -460,6 +464,10 @@ onBeforeUnmount(() => {
|
|||
cursor: text;
|
||||
transform-origin: 0% 0%;
|
||||
user-select: text;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.textLayer ::selection {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue