Core Components
The UI of Plain is organized logically in the src/components/ directory.
Editor
NoteEditor.jsx
This is the primary rich-text editing surface powered by Tiptap.
- Role: Displays the content of the currently selected note.
- Features: Handles inline styles, lists, links, tables, and inline image uploads.
- Extensions: Custom behavior is managed via
src/extensions/PlainImage.jsxand other Tiptap extensions. - Autosave: Automatically triggers store mutations after a debounce when typing.
EditorPane.jsx & EditorHeader.jsx
These components wrap the NoteEditor and provide the surrounding context (e.g., note title, pinning actions, trash status).
EmptyEditorState.jsx
Displayed when no note is selected in the sidebar. Provides a clean, empty state with an invitation to create a new note.
Sidebar & Navigation
Sidebar.jsx
The main navigation area on the left side of the screen.
- Role: Displays the
NoteList, search input, and tag filters. - Responsiveness: Acts as a persistent sidebar on desktop, and a slide-out drawer on mobile devices.
NoteList.jsx & NoteListItem.jsx
Renders the collection of notes.
- Sorting: Pinned notes appear first, followed by notes sorted by
updatedAtdescending. - Trashing: Trashed notes are sorted by
trashedAtdescending and visually distinct.
SearchInput.jsx & TagFilterBar.jsx
Allows users to filter the NoteList based on text content, titles, or assigned tags.
Export & Settings
ExportModal.jsx
Manages exporting notes to various formats (e.g., Markdown, PDF).
- Location:
src/components/export/ - Dependencies: Uses
html2canvasandjspdffor PDF generation, andturndownfor Markdown conversion.
FoundersRedeemModal.jsx
A special modal for redeeming Plain Founders Pack purchases and unlocking founders benefits.
- Location:
src/components/FoundersRedeemModal.jsx - State: Managed by
useFoundersStore.js.