mirror of https://github.com/usememos/memos.git
This commit refactors MemoView and MemoEditor components for better maintainability, introducing React Context, custom hooks, and improved folder structure. MemoView improvements: - Introduce MemoViewContext to eliminate prop drilling - Reduce MemoHeader props from 18 to 8 - Reduce MemoBody props from 9 to 4 - Extract custom hooks: useMemoViewDerivedState, useMemoEditor, useMemoHandlers for better separation of concerns - Fix React hooks ordering bug in edit mode MemoEditor improvements: - Extract state management into useMemoEditorState hook - Extract keyboard handling into useMemoEditorKeyboard hook - Extract event handlers into useMemoEditorHandlers hook - Extract initialization logic into useMemoEditorInit hook - Reduce main component from 461 to 317 lines (31% reduction) Folder structure cleanup: - Move SortableItem to memo-metadata (correct location) - Move ErrorBoundary to components folder - Flatten Toolbar/InsertMenu structure (remove unnecessary nesting) - Consolidate hooks in main hooks folder - Consolidate types in main types folder Benefits: - Better separation of concerns - Improved testability - Easier maintenance - Cleaner code organization - No functionality changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| .gitignore | ||
| biome.json | ||
| components.json | ||
| index.html | ||
| package.json | ||
| pnpm-lock.yaml | ||
| tsconfig.json | ||
| vite.config.mts | ||