* fix(app): give Markdown and HTML file tabs back their Preview and Source views The built-in Markdown and HTML panels own one toolbar again: file size, line count, save status, vim mode, cursor, and a Preview | Source control over a body that shows the rendered preview or the editor from the same loaded content and editor model. Plain text files keep the toolbar on top. The host no longer renders a panel switcher. Source is the built-in panel for text files no other built-in claims, so it is never offered beside Markdown or HTML in the picker, the Open with menu, or Settings > Files. A line target opens the file's built-in panel in its Source view. * refactor(app): name the shared text file panel TextFilePanel Markdown and HTML own a Source view; they are not Source panels. The composite in file-panels/source/panel.tsx is now TextFilePanel, and SourcePanel is TextFilePanel without a Preview. Names only.
1.2 KiB
Markdown file panel example
Requires Paseo 0.13.0 or later. Install the editor dependencies, then install this directory:
cd plugin-examples/markdown-panel
npm install
paseo plugin install "$PWD"
Open a .md or .markdown file in Files. Choose Rich Markdown — markdown-panel in the
picker. Check Don't ask me again to remember the choice on this device.
The panel is a CodeMirror editor with Markdown highlighting, line numbers, undo, redo, and line
wrapping. It reads the file once with readText, saves 500 ms after the last edit with
writeText, and reports unsaved edits with tab.setModified. When the file changes on disk with
nothing unsaved, it reads again; with unsaved edits, or when a write rejects with
PluginFileConflictError, it offers Reload and Overwrite. Open with… in the tab menu
switches the tab back to Paseo's Markdown panel. Native shows selectable, read-only text through
useFileText.
Paseo bundles the editor dependencies into this plugin. They are loaded only on web; the native
path uses React Native primitives. DOM integration lives in client/web.ts.
See the file panel reference.