feat: note history modal with restore, diff comparison, and dynamic UI updates
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m14s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m14s
- Complete rewrite of note-history-modal: version list with inline restore/delete,
split diff view with synced scrolling, rich preview for markdown/richtext/checklist
- Fix restore not updating editor: use key={id-updatedAt} on NoteInlineEditor to
force remount on restore, and add sync useEffect to reset local state on prop changes
- Add sync useEffect in NoteEditor for external note updates
- Add historyEnabled to NOTE_LIST_SELECT (no more 'Activer' on every modal open)
- Replace browser confirm() with shadcn AlertDialog for delete confirmation
- Add i18n keys: currentVersion, compareVersions, diffTitle, diffSelectHint, deleteVersionDesc
- Install diff + @types/diff for visual line diffing
- Fix MasonryGrid render-phase sync to preserve local sizes
- Update notes-tabs-view merge logic for restored note propagation
- Remove debug console.log from restoreNoteVersion
This commit is contained in:
@@ -139,6 +139,22 @@ export function NoteInlineEditor({
|
||||
const [fusionNotes, setFusionNotes] = useState<Array<Partial<Note>>>([])
|
||||
const [comparisonNotes, setComparisonNotes] = useState<Array<Partial<Note>>>([])
|
||||
|
||||
const noteContentRef = useRef(note.content)
|
||||
const noteTitleRef = useRef(note.title)
|
||||
useEffect(() => {
|
||||
if (note.content !== noteContentRef.current || note.title !== noteTitleRef.current) {
|
||||
clearTimeout(saveTimerRef.current)
|
||||
setIsDirty(false)
|
||||
setTitle(note.title || '')
|
||||
setContent(note.content || '')
|
||||
setCheckItems(note.checkItems || [])
|
||||
setNoteType(note.type)
|
||||
pendingRef.current = { title: note.title || '', content: note.content || '', checkItems: note.checkItems || [], isMarkdown: note.type === 'markdown', noteType: note.type }
|
||||
noteContentRef.current = note.content
|
||||
noteTitleRef.current = note.title
|
||||
}
|
||||
}, [note])
|
||||
|
||||
const changeTitle = (t: string) => { setTitle(t); onChange?.(note.id, { title: t }) }
|
||||
const changeContent = (c: string) => { setContent(c); onChange?.(note.id, { content: c }) }
|
||||
const changeCheckItems = (ci: CheckItem[]) => { setCheckItems(ci); onChange?.(note.id, { checkItems: ci }) }
|
||||
@@ -639,7 +655,7 @@ export function NoteInlineEditor({
|
||||
if (note.historyEnabled) {
|
||||
onOpenHistory(note)
|
||||
} else if (onEnableHistory) {
|
||||
onEnableHistory(note.id).then(() => onOpenHistory(note))
|
||||
onEnableHistory(note.id).then(() => onOpenHistory({ ...note, historyEnabled: true }))
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user