From 9014c79f2c853c9e9fed6934ff1329d7eaeabc5d Mon Sep 17 00:00:00 2001 From: Gagancreates Date: Fri, 8 May 2026 00:26:57 +0530 Subject: [PATCH 01/18] feat: render html files in knowledge view via sandboxed iframe --- apps/x/KNOWLEDGE_FILE_VIEWER.md | 246 ++++++++++++++++++ apps/x/PLAN.md | 83 ++++++ apps/x/apps/renderer/src/App.tsx | 10 + .../src/components/html-file-viewer.tsx | 38 +++ apps/x/test-fixtures/html-viewer-test.html | 104 ++++++++ 5 files changed, 481 insertions(+) create mode 100644 apps/x/KNOWLEDGE_FILE_VIEWER.md create mode 100644 apps/x/PLAN.md create mode 100644 apps/x/apps/renderer/src/components/html-file-viewer.tsx create mode 100644 apps/x/test-fixtures/html-viewer-test.html diff --git a/apps/x/KNOWLEDGE_FILE_VIEWER.md b/apps/x/KNOWLEDGE_FILE_VIEWER.md new file mode 100644 index 00000000..55d0f688 --- /dev/null +++ b/apps/x/KNOWLEDGE_FILE_VIEWER.md @@ -0,0 +1,246 @@ +# Knowledge File Viewer — Research & Implementation Plan + +## Current State + +The gap is a single `
` fallback in `App.tsx:4523–4527`. The decision tree today:
+
+```
+selectedPath ends in .md  →  MarkdownEditor (full ProseMirror, works great)
+selectedPath is anything else  →  
 raw text dump  ← THIS IS THE ENTIRE GAP
+```
+
+Everything else needed already exists:
+
+| What's needed | What exists | Where |
+|---|---|---|
+| Read binary files | `shell:readFileBase64` IPC handler | `apps/main/src/ipc.ts:648–667` |
+| Read text files | `workspace:readFile` with `encoding` param | `packages/shared/src/ipc.ts:55–67` |
+| File type detection | `attachment-presentation.ts` utilities | `renderer/src/lib/attachment-presentation.ts` |
+| Audio player component | `AudioFileCard` (base64 → `