Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(pdf): remove unnecessary highlight types
Elian Doran4b57ebf06f59
diff --git a/apps/client/src/widgets/sidebar/pdf/PdfAnnotations.tsx b/apps/client/src/widgets/sidebar/pdf/PdfAnnotations.tsxindex ae4b15a0c9..73d9f79f6f 100644--- a/apps/client/src/widgets/sidebar/pdf/PdfAnnotations.tsx+++ b/apps/client/src/widgets/sidebar/pdf/PdfAnnotations.tsx@@ -7,19 +7,7 @@ import RightPanelWidget from "../RightPanelWidget";const TYPE_ICONS: Record<string, string> = {text: "bx bxs-comment-detail",- freetext: "bx bx-text",highlight: "bx bx-highlight",- underline: "bx bx-underline",- squiggly: "bx bx-water",- strikeout: "bx bx-strikethrough",- ink: "bx bx-pen",- stamp: "bx bx-stamp",- line: "bx bx-minus",- square: "bx bx-rectangle",- circle: "bx bx-circle",- polygon: "bx bx-shape-polygon",- polyline: "bx bx-git-branch",- caret: "bx bx-caret-up"};export default function PdfAnnotations() {diff --git a/packages/pdfjs-viewer/src/annotations.spec.ts b/packages/pdfjs-viewer/src/annotations.spec.tsindex f948d9784a..23cb7866db 100644--- a/packages/pdfjs-viewer/src/annotations.spec.ts+++ b/packages/pdfjs-viewer/src/annotations.spec.ts@@ -49,7 +49,7 @@ describe("processAnnotation", () => {});it("skips non-comment types and empty annotations", () => {- const link = { ...SAMPLE_HIGHLIGHT, annotationType: AnnotationType.LINK };+ const link = { ...SAMPLE_HIGHLIGHT, annotationType: 2 }; // LINKexpect(processAnnotation(link, 1)).toBeNull();const empty = { ...SAMPLE_HIGHLIGHT, contentsObj: { str: "", dir: "ltr" }, overlaidText: "" };diff --git a/packages/pdfjs-viewer/src/annotations.ts b/packages/pdfjs-viewer/src/annotations.tsindex e10f3db83b..61e859fae7 100644--- a/packages/pdfjs-viewer/src/annotations.ts+++ b/packages/pdfjs-viewer/src/annotations.ts@@ -1,57 +1,18 @@// PDF annotation type constants (from PDF spec / pdfjs-dist AnnotationType)export const AnnotationType = {TEXT: 1,- LINK: 2,- FREETEXT: 3,- LINE: 4,- SQUARE: 5,- CIRCLE: 6,- POLYGON: 7,- POLYLINE: 8,HIGHLIGHT: 9,- UNDERLINE: 10,- SQUIGGLY: 11,- STRIKEOUT: 12,- STAMP: 13,- CARET: 14,- INK: 15,- POPUP: 16,- FILEATTACHMENT: 17} as const;-/** Annotation types that carry user-visible comments or markup. */+/** Annotation types we display in the sidebar. */const COMMENT_TYPES = new Set([AnnotationType.TEXT,- AnnotationType.FREETEXT,AnnotationType.HIGHLIGHT,- AnnotationType.UNDERLINE,- AnnotationType.SQUIGGLY,- AnnotationType.STRIKEOUT,- AnnotationType.INK,- AnnotationType.STAMP,- AnnotationType.LINE,- AnnotationType.SQUARE,- AnnotationType.CIRCLE,- AnnotationType.POLYGON,- AnnotationType.POLYLINE,- AnnotationType.CARET]);const TYPE_NAMES: Record<number, string> = {[AnnotationType.TEXT]: "text",- [AnnotationType.FREETEXT]: "freetext",[AnnotationType.HIGHLIGHT]: "highlight",- [AnnotationType.UNDERLINE]: "underline",- [AnnotationType.SQUIGGLY]: "squiggly",- [AnnotationType.STRIKEOUT]: "strikeout",- [AnnotationType.INK]: "ink",- [AnnotationType.STAMP]: "stamp",- [AnnotationType.LINE]: "line",- [AnnotationType.SQUARE]: "square",- [AnnotationType.CIRCLE]: "circle",- [AnnotationType.POLYGON]: "polygon",- [AnnotationType.POLYLINE]: "polyline",- [AnnotationType.CARET]: "caret"};/**