fix(editor): 任务列表复选框改与整段文字垂直居中(docs/33 更正)
用户指正:首版把复选框对齐首行,多行任务时贴在文字块顶部; 应与整段文字垂直居中。li.task-item 的 align-items 改 center, 复选框去掉 margin-top。无头量几何:单行/2 行/3 行任务项的复选框 中心与文字块中心偏差均为 0px。vitest 154+2、构建通过。
This commit is contained in:
@@ -16,8 +16,16 @@ styles.css 给任务项内段落去边距:首段 `margin-top: 0`、末段
|
||||
`margin-bottom: 0`(多段任务项的中间段落间距保留)。仅两条规则,
|
||||
不动 NodeView 与文档模型。
|
||||
|
||||
## 更正:复选框应与整段文字垂直居中(2026-11-16 用户指正)
|
||||
|
||||
首版把复选框对齐到**首行**(flex-start + margin-top),用户指出不对:
|
||||
多行任务时复选框贴在文字块顶部,应与**整段文字垂直居中**。已改:
|
||||
`li.task-item` 的 align-items 改为 center,复选框去掉 margin-top。
|
||||
单行任务两种对齐等价(都是行中心),多行时复选框落到文字块正中。
|
||||
|
||||
## 验证(无头 Chrome 量几何)
|
||||
|
||||
- 单行任务项高度 61 → 29px,与普通列表项一致;
|
||||
- 复选框中心与首行文字中心偏差 ≤1px(37/38、66/67);
|
||||
- 多行任务项:复选框对齐首行(158/159),续行与文字左缘对齐(悬挂缩进)。
|
||||
- 多行任务项(更正后):2 行、3 行任务项的复选框中心与整段文字块
|
||||
中心偏差均为 0px;续行与文字左缘对齐(悬挂缩进)。
|
||||
|
||||
@@ -193,12 +193,12 @@ kbd { background: var(--code-bg); border: 1px solid var(--border); border-radius
|
||||
.milkdown .ProseMirror .img-wrap.ProseMirror-selectednode .img-resize-handle { opacity: 1; pointer-events: auto; }
|
||||
.milkdown .ProseMirror a { color: var(--accent); }
|
||||
.milkdown .ProseMirror hr { border: 0; border-top: 1px solid var(--border); }
|
||||
.milkdown .ProseMirror li.task-item { list-style: none; display: flex; align-items: flex-start; gap: 2px; margin-left: -1.1em; }
|
||||
.milkdown .ProseMirror li.task-item { list-style: none; display: flex; align-items: center; gap: 2px; margin-left: -1.1em; }
|
||||
/* 任务项是 flex 布局,段落的 UA 默认上下边距不会像普通列表项那样与 li 折叠,
|
||||
会把文字整段顶下去、看起来与复选框不在一行(docs/33):首段去上边距、末段去下边距 */
|
||||
.milkdown .ProseMirror li.task-item p:first-child { margin-top: 0; }
|
||||
.milkdown .ProseMirror li.task-item p:last-child { margin-bottom: 0; }
|
||||
.milkdown .ProseMirror .task-checkbox { margin-top: 0.42em; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
|
||||
.milkdown .ProseMirror .task-checkbox { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
|
||||
.milkdown .ProseMirror li[data-checked='true'] .task-content { color: var(--text-dim); }
|
||||
.editor-pane-wrap { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center; }
|
||||
/* 编辑面填满窗格高度:空文档/短文档时下方大片区域也是可点击的输入面,
|
||||
|
||||
Reference in New Issue
Block a user