mirror of https://github.com/usememos/memos.git
This commit standardizes the design patterns across all editor enhancement features for better maintainability and consistency. Key improvements: **useListAutoCompletion hook:** - Now self-manages event listeners (consistent with useSuggestions) - Uses refs to avoid stale closures - Proper cleanup on unmount - No longer requires manual event handler in parent **useSuggestions hook:** - Enhanced TypeScript documentation with JSDoc - Added usage examples - Improved error handling with warnings - Consistent interface design **SuggestionsPopup component:** - Auto-scrolls selected item into view during keyboard navigation - Added max height (max-h-60) with proper overflow handling - Improved styling with border and shadow - Prevents text selection with select-none - Smooth scroll behavior for better UX **Editor component:** - Simplified - removed manual keyboard handler - Cleaner code with hooks managing their own concerns - Better separation of responsibilities **CommandSuggestions & TagSuggestions:** - Added comprehensive JSDoc comments - Explained filtering strategies (prefix vs substring) - Documented user interaction patterns - Clarified autocomplete behavior Benefits: - Consistent patterns across all features - Self-contained, reusable hooks - Better developer experience with docs - Improved UX with auto-scroll - Easier to maintain and test |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| .gitignore | ||
| .prettierrc.js | ||
| MARKDOWN_STYLE_GUIDE.md | ||
| README.md | ||
| components.json | ||
| eslint.config.mjs | ||
| index.html | ||
| package.json | ||
| pnpm-lock.yaml | ||
| tsconfig.json | ||
| vite.config.mts | ||