mirror of https://github.com/usememos/memos.git
Add a dialog-based table editor that makes creating and editing markdown tables much easier than manipulating raw pipe-delimited text. Features: - Visual grid of input fields for editing headers and cells - Add and remove rows and columns - Sort columns ascending/descending (supports both text and numeric) - Tab key navigation between cells (auto-creates new rows at the end) - Properly formatted/aligned markdown output on confirm - Row numbers with hover-to-delete interaction - Column sort indicators and remove buttons Integration points: 1. Toolbar: New 'Table' button in the InsertMenu (+) dropdown opens the dialog for creating new tables from the editor 2. Slash command: /table now opens the dialog instead of inserting raw markdown, via new Command.action callback support 3. Rendered tables: Edit pencil icon appears on hover over rendered tables in MemoContent, opens dialog pre-populated with parsed table data, and saves changes directly via updateMemo mutation (same pattern as TaskListItem checkbox toggling) New files: - utils/markdown-table.ts: Parse, serialize, find/replace markdown tables - components/TableEditorDialog.tsx: Reusable table editor dialog component Modified: - Extended Command interface with optional action callback for dialogs - SlashCommands handles action-based commands (skips text insertion) - Editor accepts custom commands via props - EditorContent creates commands with table editor wired in - MemoEditor manages table dialog state shared between slash cmd and toolbar - InsertMenu includes Table entry and its own dialog for toolbar flow - Table.tsx (MemoContent) adds edit button and dialog for rendered tables Co-authored-by: milvasic <milvasic@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| SlashCommands.tsx | ||
| SuggestionsPopup.tsx | ||
| TagSuggestions.tsx | ||
| commands.ts | ||
| index.tsx | ||
| shortcuts.ts | ||
| useListCompletion.ts | ||
| useSuggestions.ts | ||