AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
refactor(attachments): unify compact card width
tianma-if61035e4a0211
diff --git a/apps/web/src/components/attachments/attachment-layout.ts b/apps/web/src/components/attachments/attachment-layout.tsnew file mode 100644index 00000000..d6941953--- /dev/null+++ b/apps/web/src/components/attachments/attachment-layout.ts@@ -0,0 +1 @@+export const COMPACT_ATTACHMENT_WIDTH_CLASS = "w-full md:max-w-[680px]";diff --git a/apps/web/src/components/editor/FileAttachment.tsx b/apps/web/src/components/editor/FileAttachment.tsxindex aa4a7479..125aecf2 100644--- a/apps/web/src/components/editor/FileAttachment.tsx+++ b/apps/web/src/components/editor/FileAttachment.tsx@@ -7,8 +7,10 @@ import { NodeViewWrapper, ReactNodeViewRenderer, type NodeViewProps } from "@tipimport { Download, ExternalLink } from "lucide-react";import { useTranslation } from "react-i18next";import { AttachmentFileIcon } from "@/components/attachments/AttachmentFileIcon";+import { COMPACT_ATTACHMENT_WIDTH_CLASS } from "@/components/attachments/attachment-layout";import { ButtonTooltip } from "@/components/ui/button-tooltip";import { isDesktopResourceRuntime, toApiResourceUrl } from "@/lib/desktop-resources";+import { cn } from "@/lib/utils";const FileAttachmentNodeView = ({ node }: NodeViewProps) => {const { t } = useTranslation();@@ -23,7 +25,7 @@ const FileAttachmentNodeView = ({ node }: NodeViewProps) => {return (<NodeViewWrapper as="span" className="edgeever-file-attachment-node" contentEditable={false}>- <span className="edgeever-file-viewer flex min-h-12 w-full items-center gap-2 overflow-hidden rounded-xl border border-slate-200 bg-white px-3 shadow-sm">+ <span className={cn("edgeever-file-viewer flex min-h-12 items-center gap-2 overflow-hidden rounded-xl border border-slate-200 bg-white px-3 shadow-sm", COMPACT_ATTACHMENT_WIDTH_CLASS)}><ahref={resolvedUrl}target="_blank"diff --git a/apps/web/src/components/pdf/PdfViewer.tsx b/apps/web/src/components/pdf/PdfViewer.tsxindex 08b3428e..c17a8059 100644--- a/apps/web/src/components/pdf/PdfViewer.tsx+++ b/apps/web/src/components/pdf/PdfViewer.tsx@@ -1,4 +1,4 @@-import type { PDFDocumentProxy, PDFPageProxy } from "pdfjs-dist";+import { formatAttachmentMetadata } from "@edgeever/shared";import {ChevronDown,ChevronLeft,@@ -13,12 +13,13 @@ import {ZoomIn,ZoomOut,} from "lucide-react";+import type { PDFDocumentProxy, PDFPageProxy } from "pdfjs-dist";import { useCallback, useEffect, useRef, useState } from "react";import { createPortal } from "react-dom";import { useTranslation } from "react-i18next";-import { ButtonTooltip } from "@/components/ui/button-tooltip";import { AttachmentFileIcon } from "@/components/attachments/AttachmentFileIcon";-import { formatAttachmentMetadata } from "@edgeever/shared";+import { COMPACT_ATTACHMENT_WIDTH_CLASS } from "@/components/attachments/attachment-layout";+import { ButtonTooltip } from "@/components/ui/button-tooltip";import { isDesktopResourceRuntime, toApiResourceUrl } from "@/lib/desktop-resources";import { cn } from "@/lib/utils";import { loadPdfJs } from "./pdfjs-loader";@@ -245,7 +246,8 @@ export const PdfViewer = ({<spanref={rootRef}className={cn(- "edgeever-pdf-viewer block w-full overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm",+ "edgeever-pdf-viewer block overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm",+ expanded ? "w-full" : COMPACT_ATTACHMENT_WIDTH_CLASS,isFullscreen && "fixed inset-0 z-[120] flex rounded-none border-0 bg-slate-950/95 p-3 sm:p-5",className,)}