Files
paseo/plugin-examples/markdown-panel/index.client.tsx
T
Mohamed Boudra dfb6215de0 feat(file-panels): panels read and write through a file handle
The file tab stats the file and mounts its panel without reading it. Every
panel, built-in or plugin, gets a PluginFile handle: readText, readBytes, url,
version-checked writeText/writeBytes (PluginFileConflictError unless force),
and watch. useFileText, useFileBytes and useFileUrl read through it, and
Loading joins @getpaseo/plugin/client/ui. Panels own their loading state.

The host document pipeline, the explorer preview cache and the preview
lifecycle are deleted. The daemon classifies a file version from a bounded
sniff and writes base64 content as bytes behind fileByteWrites.

A deleted file keeps its panel mounted; a read confirms the deletion first,
so a remove-and-rewrite is not reported as one. Native Source decodes with
builtins and highlights in idle-time slices, the lines around the opening
line first, so a large file no longer blocks the JS thread.
2026-10-20 08:02:49 +02:00

14 lines
402 B
TypeScript

import type { PluginClientContext } from "@getpaseo/plugin/client";
import { RichMarkdownPanel } from "./client/rich-markdown";
export default function contribute(client: PluginClientContext) {
client.addFilePanel({
id: "rich-markdown",
title: "Rich Markdown",
icon: "FileType",
files: { extensions: ["md", "markdown"] },
Component: RichMarkdownPanel,
});
return () => {};
}