Skip to content

1.4.0 — Text-anchored annotation rewrite

Latest

Choose a tag to compare

@gibsonchan-5 gibsonchan-5 released this 23 Aug 10:15

1.4.0 — Text-anchored annotation rewrite

Highlights

  • Complete rewrite of the annotation engine: every highlight is now identified by page range + text content instead of fragile DOM Range/Node references.
  • Initial highlighting and restore now share the same text-locating pipeline — what can be highlighted can always be restored.

Bug Fixes

  • Cross-page highlight could not locate selected text on restore — root cause: per-page restore was matching the full cross-page string against a single page's textLayer, which can never match.
  • Same-page highlight occasionally failed when selection overlapped existing highlights — root cause: collectSegmentsDirect skipped nodes already marked with fleurSel, so an entirely-in-old-highlight selection produced zero segments.
  • compareBoundaryPoints branch logic was inverted, so the actual start/end offsets were never applied.
  • Selection endpoints outside the .page element returned immediately — cross-page drag-selection commonly starts from a container-level node.

New

  • New command: FleurPDF: 重新渲染当前 PDF 的标注
  • New command: FleurPDF: 诊断当前 PDF 结构 (shows page layout, selection page-range, per-page text split in a Notice)
  • Five-level in-page text matching with NFKC normalization as fallback when DOM intersection fails
  • splitAnnotationTextByPage for restoring cross-page annotations (greedy per-page split: first page = start → page-tail, last page = remainder)

Notes for reviewers

  • main.js is now tracked in git (required by Obsidian community plugin review)
  • versions.json updated for 1.4.0 → minAppVersion 1.7.2

Upgrade in Obsidian → Settings → Community plugins → FleurPDF.