Skip to content

Conversation

scottymcandrew
Copy link

Summary

  • Fixes PDF highlights not rendering properly in blocks
  • Improves detection of PDF annotation blocks
  • Adds better error handling for area highlight images

Problem

PDF highlights (both text and area) were not rendering correctly in blocks. Users would see the reference but not the highlight content or images. The page reference link (e.g., "P3") was also missing in some cases.

Solution

  1. Improved PDF annotation detection: The code now checks for PDF-specific properties (pdf/hl-page, pdf/hl-type, pdf/hl-value) in addition to the ls-type: annotation property
  2. Better error handling: Added try-catch blocks and error states for area highlight image loading
  3. Debug logging: Added console logging to help diagnose issues with highlight rendering

Changes

  • Modified block.cljs to make PDF annotation detection more robust
  • Updated assets.cljs to add better error handling and logging for area display
  • Both text and area highlights now properly show the page reference link

Testing

  • Tested with existing PDF highlights that were missing the ls-type property
  • Verified area highlights display properly with error messages when images fail to load
  • Confirmed page reference links appear for both text and area highlights

Fixes #[issue-number]

scottymcandrew and others added 2 commits May 31, 2025 08:54
- Make PDF annotation detection more robust by checking for PDF-specific properties
- Add better error handling and logging for area highlight image loading
- Fix issue where highlights without ls-type:annotation weren't showing page refs
- Add console debugging to help diagnose highlight rendering issues

This fixes cases where PDF highlights (both text and area) weren't
rendering properly in blocks, particularly when the ls-type property
wasn't set correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants