Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
clickable links
Aashish-Upadhyay-101f7c0c0adc5ba
diff --git a/components/view/PagesViewer.tsx b/components/view/PagesViewer.tsxindex 01ff69ac..b7e35d6a 100644--- a/components/view/PagesViewer.tsx+++ b/components/view/PagesViewer.tsx@@ -19,7 +19,7 @@ export default function PagesViewer({versionNumber,brand,}: {- pages: { file: string; pageNumber: string }[];+ pages: { file: string; pageNumber: string; embeddedLinks: string[] }[];linkId: string;documentId: string;viewId: string;@@ -149,6 +149,7 @@ export default function PagesViewer({numPages={numPages}assistantEnabled={assistantEnabled}brand={brand}+ embeddedLinks={pages[pageNumber - 1].embeddedLinks}/><divstyle={{ height: "calc(100vh - 64px)" }}diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex 09130403..c5a27943 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -16,7 +16,7 @@ import { Brand } from "@prisma/client";export type DEFAULT_DOCUMENT_VIEW_TYPE = {viewId: string;file: string | null;- pages: { file: string; pageNumber: string }[] | null;+ pages: { file: string; pageNumber: string; embeddedLinks: string[] }[] | null;};export default function DocumentView({diff --git a/components/view/nav.tsx b/components/view/nav.tsxindex ab521c57..185a40bb 100644--- a/components/view/nav.tsx+++ b/components/view/nav.tsx@@ -5,6 +5,14 @@ import PapermarkSparkle from "../shared/icons/papermark-sparkle";import { Download } from "lucide-react";import { Brand } from "@prisma/client";import Image from "next/image";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import DropDown from "../web/alternatives/dropdownproto";++// TODO: trigger dev job start garni ani matra file upload garni ho kexport default function Nav({pageNumber,@@ -13,6 +21,7 @@ export default function Nav({assistantEnabled,file,brand,+ embeddedLinks,}: {pageNumber: number;numPages: number;@@ -20,6 +29,7 @@ export default function Nav({assistantEnabled?: boolean;file?: { name: string; url: string };brand?: Brand;+ embeddedLinks?: string[];}) {const router = useRouter();const { linkId } = router.query as { linkId: string };@@ -77,7 +87,29 @@ export default function Nav({)}</div></div>- <div className="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0 space-x-2">+ <div className="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0 space-x-4">+ {embeddedLinks && embeddedLinks.length > 0 && (+ <DropdownMenu>+ <DropdownMenuTrigger>+ <div className="text-sm font-semibold mr-6">+ Embedded Links+ </div>+ </DropdownMenuTrigger>+ <DropdownMenuContent className="space-y-2 pt-2 px-4">+ {embeddedLinks.map((link, index) => (+ <Link+ href={link}+ target="_blank"+ className="text-sm flex items-start gap-2"+ key={index}+ >+ <span>{index + 1}.</span>+ <span className="underline">{link}</span>+ </Link>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ )}{assistantEnabled ? (<Link href={`/view/${linkId}/chat`}><Buttondiff --git a/pages/api/mupdf/convert-page.ts b/pages/api/mupdf/convert-page.tsindex 50f48ee7..17ba4e0b 100644--- a/pages/api/mupdf/convert-page.ts+++ b/pages/api/mupdf/convert-page.ts@@ -31,6 +31,11 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {var doc = mupdf.Document.openDocument(pdfData, "application/pdf");var page = doc.loadPage(pageNumber - 1); // 0-based page index++ // get links+ const links = page.getLinks();+ const embeddedLinks = links.map((link: any) => link.getURI());+var pixmap = page.toPixmap(// mupdf.Matrix.identity,[3, 0, 0, 3, 0, 0], // scale 3x@@ -53,6 +58,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {versionId: documentVersionId,pageNumber: pageNumber,file: blob.url,+ embeddedLinks: embeddedLinks,},});diff --git a/pages/api/views.ts b/pages/api/views.tsindex cd9dfd27..bcf2e51c 100644--- a/pages/api/views.ts+++ b/pages/api/views.ts@@ -85,6 +85,7 @@ export default async function handle(select: {file: true,pageNumber: true,+ embeddedLinks: true,},});console.timeEnd("get-pages");diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex 642efc5a..9b45d67f 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -6,7 +6,7 @@ datasource db {}generator client {- provider = "prisma-client-js"+ provider = "prisma-client-js"previewFeatures = ["relationJoins"]}@@ -76,15 +76,15 @@ model Team {}model Brand {- id String @id @default(cuid())+ id String @id @default(cuid())logo String? // This should be a reference to where the file is stored (S3, Google Cloud Storage, etc.)brandColor String? // This should be a reference to the brand coloraccentColor String? // This should be a reference to the accent color- teamId String @unique- team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)+ teamId String @unique+ team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)- createdAt DateTime @default(now())- updatedAt DateTime @updatedAt+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt}enum Role {@@ -155,13 +155,14 @@ model DocumentVersion {}model DocumentPage {- id String @id @default(cuid())- version DocumentVersion @relation(fields: [versionId], references: [id], onDelete: Cascade)- versionId String- pageNumber Int // e.g., 1, 2, 3 for- file String // This should be a reference to where the file / page is stored (S3, Google Cloud Storage, etc.)- createdAt DateTime @default(now())- updatedAt DateTime @updatedAt+ id String @id @default(cuid())+ version DocumentVersion @relation(fields: [versionId], references: [id], onDelete: Cascade)+ versionId String+ pageNumber Int // e.g., 1, 2, 3 for+ embeddedLinks String[]+ file String // This should be a reference to where the file / page is stored (S3, Google Cloud Storage, etc.)+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt@@unique([pageNumber, versionId])@@index([versionId])@@ -190,9 +191,9 @@ model Link {enableFeedback Boolean? @default(true) // Optional give user a option to enable the feedback toolbar// custom metatags- metaTitle String? // This will be the meta title of the link- metaDescription String? // This will be the meta description of the link- metaImage String? // This will be the meta image of the link+ metaTitle String? // This will be the meta title of the link+ metaDescription String? // This will be the meta description of the link+ metaImage String? // This will be the meta image of the linkenableCustomMetatag Boolean? @default(false) // Optional give user a option to enable the custom metatag@@unique([domainSlug, slug])