seemore 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seemore",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Let AI write the Markdown. Let seemore show it better — zero config documentation framework.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,17 +11,23 @@ import { FileText } from 'lucide-react';
11
11
  *
12
12
  * `pdfjs-dist` is roughly a megabyte, which is a poor trade for a docs site. The accepted
13
13
  * cost is that some environments degrade `<embed>` to a blank box, since they don't support
14
- * inline PDF plugins — most mobile browsers, but also Electron-based webviews (VS Code's
15
- * preview included), which don't ship Chrome's PDF viewer extension despite reporting a
14
+ * inline PDF plugins — most mobile browsers, but also the VS Code extension's webview, whose
15
+ * bundled Electron/Chromium doesn't ship Chrome's PDF viewer extension despite reporting a
16
16
  * fine pointer. The CSS `(pointer: coarse)` fallback in globals.css only catches the first
17
- * group, so `navigator.pdfViewerEnabled` — Chromium/Firefox's direct feature check — is used
18
- * to catch the second by toggling the same fallback via a class instead of a media query.
17
+ * group. `navigator.pdfViewerEnabled` (Chromium/Firefox's direct feature check) would be the
18
+ * clean way to catch the second, but the Electron build VS Code ships predates that API, so
19
+ * `'pdfViewerEnabled' in navigator` is false there too and never flips it. Instead this reuses
20
+ * the same signal `ExternalLinkBridge.ts` uses for the identical webview: the site only ever
21
+ * runs inside a nested, cross-origin iframe when the VS Code extension put it there (see
22
+ * `panelHtml.ts`), so `window.parent !== window` is a reliable stand-in.
19
23
  */
20
24
  export function Pdf({ src, title, ...props }: ComponentProps<'embed'> & { src: string }) {
21
25
  const [unsupported, setUnsupported] = useState(false);
22
26
 
23
27
  useEffect(() => {
24
- if ('pdfViewerEnabled' in navigator && !navigator.pdfViewerEnabled) {
28
+ const noPdfViewerApi = 'pdfViewerEnabled' in navigator && !navigator.pdfViewerEnabled;
29
+ const embeddedWebview = window.parent !== window;
30
+ if (noPdfViewerApi || embeddedWebview) {
25
31
  setUnsupported(true);
26
32
  }
27
33
  }, []);