feat: deliver P2 v0.2.0 with unified editor, search, and snapshots

Implement schema v2 migration, outline/setting/inspiration CRUD, unified TipTap editing, reference panel with mentions, FTS global search, chapter version history, writing landmarks, word frequency analysis, light theme contrast fixes, and full unit/E2E test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 14:13:27 +08:00
parent 91c93954df
commit aac51bf183
72 changed files with 5790 additions and 203 deletions
+12 -1
View File
@@ -2,6 +2,7 @@ import { ipcMain } from 'electron'
import { IPC } from '../../../shared/ipc-channels'
import type { ChapterStatus } from '../../../shared/types'
import { BookRegistryService } from '../../services/book-registry'
import { ftsSync } from '../../services/fts-sync.service'
import { wrap } from '../result'
export function registerChapterHandlers(registry: BookRegistryService): void {
@@ -40,7 +41,9 @@ export function registerChapterHandlers(registry: BookRegistryService): void {
wrap(() => {
const repo = registry.getChapterRepo(bookId)
const sortOrder = repo.nextSortOrder(volumeId)
return repo.create(volumeId, title, sortOrder)
const chapter = repo.create(volumeId, title, sortOrder)
ftsSync.upsert(registry.getDb(bookId), 'chapter', chapter.id, chapter.title, chapter.content)
return chapter
})
)
@@ -81,6 +84,13 @@ export function registerChapterHandlers(registry: BookRegistryService): void {
status,
cursorOffset
})
ftsSync.upsert(
registry.getDb(bookId),
'chapter',
chapter.id,
chapter.title,
chapter.content
)
registry.updateMeta(bookId, { lastChapterId: chapterId })
return chapter
})
@@ -91,6 +101,7 @@ export function registerChapterHandlers(registry: BookRegistryService): void {
(_event, { bookId, chapterId }: { bookId: string; chapterId: string }) =>
wrap(() => {
registry.getChapterRepo(bookId).delete(chapterId)
ftsSync.remove(registry.getDb(bookId), 'chapter', chapterId)
})
)
}