fix(editor): 任务列表复选框按像素墨迹对齐第一行(docs/33 三次修正)
用户三次反馈:字形框量 0px 仍看着偏上。改按 2 倍截图像素墨迹量: 汉字墨迹中心比字形框中心低,框实测高 1.25px,margin-top 下调 1.25px(公式修正项 -1px 改 +0.25px)。复测三项墨迹中心差 +0.25/-0.75/-0.75px,已在像素量化噪声内。vitest 154+2、构建通过。
This commit is contained in:
@@ -28,12 +28,21 @@ styles.css 给任务项内段落去边距:首段 `margin-top: 0`、末段
|
|||||||
上一版改成对整段文字垂直居中仍不对:用户明确要求复选框在**第一行
|
上一版改成对整段文字垂直居中仍不对:用户明确要求复选框在**第一行
|
||||||
文字**上居中,多行任务时也留在第一行。最终实现:align-items 回到
|
文字**上居中,多行任务时也留在第一行。最终实现:align-items 回到
|
||||||
flex-start;复选框 margin-top = calc((1.78em - 15px) / 2 - 1px),
|
flex-start;复选框 margin-top = calc((1.78em - 15px) / 2 - 1px),
|
||||||
即第一行行盒中心减去字形框相对行盒中心约 1px 的上偏。注意复选框
|
即第一行行盒中心减去字形框相对行盒中心的上偏(该近似后被墨迹实测取代,见下「三次修正」)。注意复选框
|
||||||
是表单控件、默认不继承字号(UA 13.33px),须先 font-size: inherit,
|
是表单控件、默认不继承字号(UA 13.33px),须先 font-size: inherit,
|
||||||
否则 em 按 13.33px 算、偏移会差 2px 以上。实测:单行/2 行/3 行任务
|
否则 em 按 13.33px 算、偏移会差 2px 以上。实测:单行/2 行/3 行任务
|
||||||
项的复选框中心与第一行中心偏差 0、0、0、-1px;与整段中心偏差
|
项的复选框中心与第一行中心偏差 0、0、0、-1px;与整段中心偏差
|
||||||
-1、-15、-31px(确认留在第一行、未跑到段中)。
|
-1、-15、-31px(确认留在第一行、未跑到段中)。
|
||||||
|
|
||||||
|
## 三次修正:按像素墨迹对齐(2026-11-16 用户三次反馈)
|
||||||
|
|
||||||
|
字形框(Range 矩形)量出来 0px 后用户仍看着偏上:汉字墨迹中心比
|
||||||
|
字形框中心低约 1.25px。改按 2 倍截图的像素墨迹量(框边框墨迹行
|
||||||
|
与首行文字墨迹行各取上下界求中心),实测框比文字高 1.25px,
|
||||||
|
margin-top 相应下调 1.25px(公式修正项由 -1px 改为 +0.25px)。
|
||||||
|
复测三项墨迹中心差 +0.25 / -0.75 / -0.75px,已在像素量化噪声内
|
||||||
|
(±0.5px/行)。教训:对齐校验要量墨迹,不要只量字形框。
|
||||||
|
|
||||||
## 验证(无头 Chrome 量几何)
|
## 验证(无头 Chrome 量几何)
|
||||||
|
|
||||||
- 单行任务项高度 61 → 29px,与普通列表项一致;
|
- 单行任务项高度 61 → 29px,与普通列表项一致;
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ kbd { background: var(--code-bg); border: 1px solid var(--border); border-radius
|
|||||||
会把文字整段顶下去、看起来与复选框不在一行(docs/33):首段去上边距、末段去下边距 */
|
会把文字整段顶下去、看起来与复选框不在一行(docs/33):首段去上边距、末段去下边距 */
|
||||||
.milkdown .ProseMirror li.task-item p:first-child { margin-top: 0; }
|
.milkdown .ProseMirror li.task-item p:first-child { margin-top: 0; }
|
||||||
.milkdown .ProseMirror li.task-item p:last-child { margin-bottom: 0; }
|
.milkdown .ProseMirror li.task-item p:last-child { margin-bottom: 0; }
|
||||||
.milkdown .ProseMirror .task-checkbox { font-size: inherit; margin-top: calc((1.78em - 15px) / 2 - 1px); width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
|
.milkdown .ProseMirror .task-checkbox { font-size: inherit; margin-top: calc((1.78em - 15px) / 2 + 0.25px); width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
|
||||||
.milkdown .ProseMirror li[data-checked='true'] .task-content { color: var(--text-dim); }
|
.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; }
|
.editor-pane-wrap { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center; }
|
||||||
/* 编辑面填满窗格高度:空文档/短文档时下方大片区域也是可点击的输入面,
|
/* 编辑面填满窗格高度:空文档/短文档时下方大片区域也是可点击的输入面,
|
||||||
|
|||||||
Reference in New Issue
Block a user