diff --git a/manifest.ts b/manifest.ts index bdc4ecf..cfe695f 100644 --- a/manifest.ts +++ b/manifest.ts @@ -35,7 +35,7 @@ import type { PluginManifest } from '@@/plugins/manifest'; */ export const manifest: PluginManifest = { publisher: 'officerdev', - version: '2026.08.29.24', + version: '2026.08.29.25', platform: '>=1.0.0', label: 'Fofos', diff --git a/web/MediaPanel.tsx b/web/MediaPanel.tsx index ef818b9..6458a7f 100644 --- a/web/MediaPanel.tsx +++ b/web/MediaPanel.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'; +import { useSearchParams } from 'react-router'; import { FolderOpen, TriangleAlert } from 'lucide-react'; -import { FileBrowserApp } from 'officerdev'; +import { FileBrowserApp, FileViewerView } from 'officerdev'; import { useClient } from 'hooks/useClient'; /** @@ -40,6 +41,10 @@ export const MediaPanel = () => { const clientRef = useRef(client); clientRef.current = client; + const [params, setParams] = useSearchParams(); + // Set by the browser when a file is double-clicked. Nothing else on this screen reads it. + const viewPath = params.get('view'); + const [settings, setSettings] = useState(null); const [denied, setDenied] = useState(false); @@ -102,6 +107,37 @@ export const MediaPanel = () => { `panelId` stays alongside: the URL covers a reload or a shared link, panelId covers a panel re-opened later, which the URL cannot. */ + /* + ── The preview, which needed doing here rather than coming for free ── + + On /files the viewer is not part of the browser: `useFileViewerPanels` lives on the SCREEN and swaps + the whole workspace layout when `?view=` appears, opening a viewer panel beside it. A plugin renders + its own `defaultLayout` and has no such hook, so double-clicking a file here set `?view=` and nothing + ever read it. It looked like it worked only while `urlPath` was navigating to /files, where that + screen did the work. + + So the panel reads `?view=` itself and shows the viewer over the browser. Over rather than beside, + because this panel is one column of a two-column screen — splitting it again would leave a preview + the width of a phone. + + Closing clears `view` and leaves `media` alone, so you come back to the folder you were in rather + than the top. + */ + if (viewPath) { + return ( + { + const next = new URLSearchParams(params); + next.delete('view'); + next.delete('viewRoot'); + setParams(next); + }} + /> + ); + } + return ; };