feat: add UI improvements to notes list
- Add color-coded category badges with consistent pastel colors - Fix scroll jump issue when editing at bottom of note - Add localStorage persistence for notes list width - Prevent notes list from shrinking with flex-shrink-0 - Preserve cursor and scroll position during textarea resize
This commit is contained in:
@@ -64,8 +64,16 @@ export function NoteEditor({ note, onUpdateNote, onUnsavedChanges, categories, i
|
||||
// Use setTimeout to ensure DOM has updated
|
||||
setTimeout(() => {
|
||||
if (textareaRef.current) {
|
||||
// Save cursor position and scroll position
|
||||
const cursorPosition = textareaRef.current.selectionStart;
|
||||
const scrollTop = textareaRef.current.scrollTop;
|
||||
|
||||
textareaRef.current.style.height = 'auto';
|
||||
textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px';
|
||||
|
||||
// Restore cursor position and scroll position
|
||||
textareaRef.current.setSelectionRange(cursorPosition, cursorPosition);
|
||||
textareaRef.current.scrollTop = scrollTop;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user