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
+20 -1
View File
@@ -33,6 +33,25 @@ input,
select,
textarea {
font-family: inherit;
color: var(--input-text);
background: var(--input-bg);
border: 1px solid var(--input-border);
}
.form-control {
padding: 6px 8px;
border-radius: 4px;
color: var(--input-text);
background: var(--input-bg);
border: 1px solid var(--input-border);
}
.form-control--narrow {
width: 160px;
}
.form-control--wide {
width: 100%;
}
.btn {
@@ -52,7 +71,7 @@ textarea {
.btn.primary {
background: var(--accent);
border-color: var(--accent);
color: #fff;
color: var(--text-on-accent);
}
.btn.primary:hover {
+474 -2
View File
@@ -84,7 +84,7 @@
.window-close:hover {
background: var(--red) !important;
color: #fff !important;
color: var(--text-on-accent) !important;
}
#main-area {
@@ -128,7 +128,7 @@
.btn-large.primary {
background: var(--accent);
border-color: var(--accent);
color: #fff;
color: var(--text-on-accent);
}
.book-grid {
@@ -175,6 +175,7 @@
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
min-height: 0;
}
.sidebar-header {
@@ -212,7 +213,121 @@
}
.sidebar-panel.active {
display: flex;
flex-direction: column;
min-height: 0;
}
.sidebar-list {
flex: 1;
overflow-y: auto;
}
.sidebar-empty {
padding: 16px;
font-size: 12px;
color: var(--text-muted);
text-align: center;
}
.outline-item {
display: flex;
align-items: center;
gap: 4px;
padding: 6px 12px;
font-size: 12px;
cursor: pointer;
color: var(--text-secondary);
border-left: 3px solid transparent;
}
.outline-item.uncovered {
border-left-color: var(--orange);
}
.outline-item.active,
.setting-item.active,
.inspiration-item.active {
background: var(--bg-hover);
color: var(--text-primary);
}
.outline-warn {
font-size: 10px;
color: var(--orange);
flex-shrink: 0;
}
.outline-title {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.outline-title-input {
flex: 1;
padding: 2px 4px;
font-size: 12px;
}
.setting-group-header {
padding: 8px 12px;
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
display: flex;
align-items: center;
gap: 6px;
}
.setting-group-count {
margin-left: auto;
font-size: 10px;
color: var(--text-dim);
}
.setting-item {
padding: 7px 12px 7px 24px;
font-size: 12px;
cursor: pointer;
color: var(--text-secondary);
}
.inspiration-item {
padding: 8px 12px;
border-bottom: 1px solid var(--border);
cursor: pointer;
}
.inspiration-title {
font-size: 12px;
font-weight: 500;
color: var(--text-primary);
margin-bottom: 4px;
}
.inspiration-preview {
font-size: 11px;
color: var(--text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.form-label {
display: block;
margin-top: 12px;
font-size: 12px;
color: var(--text-secondary);
}
.dialog-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 16px;
}
.vol-header {
@@ -309,7 +424,9 @@
}
.editor-content-wrap {
position: relative;
flex: 1;
min-height: 0;
overflow-y: auto;
background: var(--editor-bg);
}
@@ -424,6 +541,10 @@
overflow-y: auto;
}
.settings-heading {
margin-bottom: 20px;
}
.setting-item {
display: flex;
align-items: center;
@@ -513,3 +634,354 @@
background: var(--bg-tertiary);
color: var(--text-muted);
}
.outline-toolbar {
display: flex;
gap: 6px;
padding: 8px;
border-bottom: 1px solid var(--border);
}
.outline-toolbar select {
flex: 1;
font-size: 11px;
}
.outline-toolbar .btn {
font-size: 10px;
padding: 4px 8px;
white-space: nowrap;
}
#outline-compare-view {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
.compare-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-bottom: 1px solid var(--border);
font-size: 12px;
font-weight: 600;
}
.compare-body {
flex: 1;
display: flex;
min-height: 0;
}
.compare-left {
width: 35%;
overflow-y: auto;
border-right: 1px solid var(--border);
}
.compare-right {
flex: 1;
overflow-y: auto;
padding: 16px;
}
.compare-chapter-content {
font-size: 14px;
line-height: 1.8;
color: var(--text-primary);
}
.compare-footer {
display: flex;
gap: 16px;
align-items: center;
padding: 8px 12px;
border-top: 1px solid var(--border);
font-size: 11px;
color: var(--text-secondary);
}
.compare-deviation-warn {
color: var(--red);
font-weight: 600;
}
#reference-panel {
width: 0;
overflow: hidden;
transition: width 0.2s ease;
border-left: 1px solid var(--border);
background: var(--bg-secondary);
display: flex;
flex-direction: column;
flex-shrink: 0;
}
#reference-panel.open {
width: 240px;
padding: 10px;
gap: 8px;
}
.ref-header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
font-weight: 600;
}
.ref-tabs {
display: flex;
gap: 4px;
}
.ref-tab {
flex: 1;
padding: 4px;
font-size: 10px;
border: 1px solid var(--border);
background: var(--bg-tertiary);
color: var(--text-muted);
border-radius: 4px;
cursor: pointer;
}
.ref-tab.active {
color: var(--accent-light);
border-color: var(--accent);
}
.ref-list {
flex: 1;
overflow-y: auto;
}
.ref-item {
padding: 8px;
border-bottom: 1px solid var(--border);
cursor: grab;
font-size: 11px;
}
.ref-item-title {
font-weight: 600;
color: var(--text-primary);
}
.ref-item-preview {
color: var(--text-muted);
margin-top: 2px;
}
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.65);
display: flex;
align-items: center;
justify-content: center;
z-index: 3000;
}
.modal-content {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
width: min(560px, 92vw);
max-height: 80vh;
display: flex;
flex-direction: column;
}
.modal-content--wide {
width: min(720px, 95vw);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.modal-header h3 {
font-size: 14px;
margin: 0;
}
.modal-close {
border: none;
background: transparent;
color: var(--text-muted);
cursor: pointer;
font-size: 16px;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 12px;
}
.search-options {
display: flex;
gap: 12px;
margin: 8px 0;
font-size: 11px;
color: var(--text-secondary);
}
.search-history {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-bottom: 8px;
}
.search-results {
flex: 1;
overflow-y: auto;
max-height: 320px;
}
.search-result {
padding: 8px 10px;
border-bottom: 1px solid var(--border);
cursor: pointer;
font-size: 12px;
}
.search-result.active,
.search-result:hover {
background: var(--bg-hover);
}
.sr-type {
font-size: 10px;
color: var(--accent-light);
margin-bottom: 4px;
}
.version-layout {
display: flex;
gap: 12px;
min-height: 240px;
}
.version-list {
width: 180px;
overflow-y: auto;
border-right: 1px solid var(--border);
}
.version-item {
display: block;
width: 100%;
text-align: left;
padding: 8px;
border: none;
border-bottom: 1px solid var(--border);
background: transparent;
color: var(--text-secondary);
cursor: pointer;
font-size: 11px;
}
.version-item.active {
background: var(--bg-hover);
color: var(--text-primary);
}
.version-time {
font-size: 10px;
color: var(--text-muted);
margin-top: 2px;
}
.version-diff {
flex: 1;
overflow-y: auto;
font-size: 13px;
line-height: 1.6;
}
.diff-view ins {
background: color-mix(in srgb, var(--green) 25%, transparent);
text-decoration: none;
}
.diff-view del {
background: color-mix(in srgb, var(--red) 20%, transparent);
text-decoration: line-through;
}
.wordfreq-panel {
font-size: 12px;
}
.wordfreq-list {
max-height: 360px;
overflow-y: auto;
}
.wordfreq-item {
display: flex;
justify-content: space-between;
padding: 4px 0;
border-bottom: 1px solid var(--border);
}
.wordfreq-item.overuse {
background: color-mix(in srgb, var(--orange) 15%, transparent);
}
.landmark-mark {
background: color-mix(in srgb, var(--orange) 20%, transparent);
border-radius: 3px;
padding: 0 2px;
font-size: 12px;
color: var(--orange);
}
.setting-mention {
color: var(--accent-light);
background: color-mix(in srgb, var(--accent) 15%, transparent);
border-radius: 3px;
padding: 0 2px;
cursor: pointer;
}
.mention-dropdown {
position: absolute;
left: 16px;
bottom: 8px;
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
max-height: 160px;
overflow-y: auto;
z-index: 10;
min-width: 160px;
}
.mention-item {
display: block;
width: 100%;
text-align: left;
padding: 6px 10px;
border: none;
background: transparent;
color: var(--text-primary);
cursor: pointer;
font-size: 12px;
}
.mention-item:hover {
background: var(--bg-hover);
}
+66
View File
@@ -10,6 +10,10 @@
--text-secondary: #b8aca0;
--text-muted: #786858;
--text-dim: #584838;
--text-on-accent: #ffffff;
--input-text: var(--text-primary);
--input-bg: var(--bg-surface);
--input-border: var(--border);
--accent: #c0504a;
--accent-glow: rgba(192, 80, 74, 0.25);
--accent-light: #d4706a;
@@ -33,13 +37,18 @@
--bg-tertiary: #242820;
--bg-surface: #282c24;
--bg-hover: #2e322a;
--bg-active: #343830;
--bg-card: #20241c;
--text-primary: #e0e4d8;
--text-secondary: #b0b8a8;
--text-muted: #687858;
--text-dim: #506040;
--accent: #7a9a60;
--accent-glow: rgba(122, 154, 96, 0.25);
--accent-light: #98b878;
--accent-dark: #5a7848;
--border: #303828;
--border-light: #404830;
--editor-bg: #1a1e18;
--editor-text: #e0e4d8;
}
@@ -48,13 +57,20 @@
--bg-primary: #1a1e24;
--bg-secondary: #1e2228;
--bg-tertiary: #242830;
--bg-surface: #282c34;
--bg-hover: #2e3238;
--bg-active: #343840;
--bg-card: #202428;
--text-primary: #d8dce4;
--text-secondary: #a8b0b8;
--text-muted: #687078;
--text-dim: #505860;
--accent: #8098b8;
--accent-glow: rgba(128, 152, 184, 0.25);
--accent-light: #a0b4d0;
--accent-dark: #607890;
--border: #2a3038;
--border-light: #3a4048;
--editor-bg: #1a1e24;
--editor-text: #d8dce4;
}
@@ -63,14 +79,27 @@
--bg-primary: #f4efe4;
--bg-secondary: #faf6ee;
--bg-tertiary: #efe8d8;
--bg-surface: #f8f4ea;
--bg-hover: #e8e0d0;
--bg-active: #e0d8c8;
--bg-card: #fcf6ec;
--text-primary: #3a3028;
--text-secondary: #6a5a48;
--text-muted: #988878;
--text-dim: #b8a898;
--text-on-accent: #ffffff;
--input-text: #3a3028;
--input-bg: #ffffff;
--input-border: #d0c8b8;
--accent: #8b4513;
--accent-glow: rgba(139, 69, 19, 0.15);
--accent-light: #a86030;
--accent-dark: #6b3509;
--green: #507850;
--orange: #a07040;
--red: #a04030;
--border: #d8d0c0;
--border-light: #c8c0b0;
--editor-bg: #fdf9f2;
--editor-text: #3a3028;
}
@@ -79,12 +108,27 @@
--bg-primary: #eff0f2;
--bg-secondary: #f5f6f8;
--bg-tertiary: #eaeaee;
--bg-surface: #ffffff;
--bg-hover: #e2e3e8;
--bg-active: #d8dae0;
--bg-card: #f8f8fa;
--text-primary: #2c3038;
--text-secondary: #585c68;
--text-muted: #787c88;
--text-dim: #989ca8;
--text-on-accent: #ffffff;
--input-text: #2c3038;
--input-bg: #ffffff;
--input-border: #c8cad0;
--accent: #6878a0;
--accent-glow: rgba(104, 120, 160, 0.15);
--accent-light: #8898b8;
--accent-dark: #506080;
--green: #508860;
--orange: #a08050;
--red: #a05050;
--border: #d8dae0;
--border-light: #c8cad0;
--editor-bg: #f8f9fc;
--editor-text: #2c3038;
}
@@ -93,12 +137,27 @@
--bg-primary: #eef0e4;
--bg-secondary: #f4f6ec;
--bg-tertiary: #e6e8d8;
--bg-surface: #fafcf4;
--bg-hover: #dee2d0;
--bg-active: #d4d8c8;
--bg-card: #f2f4e8;
--text-primary: #2d3a28;
--text-secondary: #4a5840;
--text-muted: #6a7860;
--text-dim: #8a9880;
--text-on-accent: #ffffff;
--input-text: #2d3a28;
--input-bg: #ffffff;
--input-border: #c0c8b0;
--accent: #688848;
--accent-glow: rgba(104, 136, 72, 0.15);
--accent-light: #88a868;
--accent-dark: #506838;
--green: #508848;
--orange: #908050;
--red: #985848;
--border: #d0d8c0;
--border-light: #c0c8b0;
--editor-bg: #f6faf0;
--editor-text: #2d3a28;
}
@@ -107,13 +166,20 @@
--bg-primary: #1f1a16;
--bg-secondary: #241e1a;
--bg-tertiary: #2a2420;
--bg-surface: #2e2824;
--bg-hover: #342e28;
--bg-active: #3a3428;
--bg-card: #26201c;
--text-primary: #e8dcc8;
--text-secondary: #b8a890;
--text-muted: #887868;
--text-dim: #685848;
--accent: #c88850;
--accent-glow: rgba(200, 136, 80, 0.25);
--accent-light: #d8a870;
--accent-dark: #a87040;
--border: #383028;
--border-light: #484038;
--editor-bg: #1f1a16;
--editor-text: #e8dcc8;
}