From 873ccb1a800baaa7dccc8faec51eefe22cd99625 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 2 Jul 2026 14:42:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20task=20list=20label=20=E5=86=85?= =?UTF-8?q?=20checkbox=20=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit label 默认是 inline 元素,内部 checkbox(inline-block)受父级行高影响会产生 基线间距,导致 checkbox 在 label 盒子内偏上,即便 li 用了 align-items: center 也只对齐了 label 盒子而非 checkbox 本身。 给 label 加 display: flex + align-items: center + line-height: 0,消除行高 撑出的基线空间,让 checkbox 严格居于 label 盒子中心。 --- libs/tiptap-editor/src/style.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/tiptap-editor/src/style.css b/libs/tiptap-editor/src/style.css index 65821a2..861b1d7 100644 --- a/libs/tiptap-editor/src/style.css +++ b/libs/tiptap-editor/src/style.css @@ -339,6 +339,12 @@ flex-shrink: 0; cursor: pointer; user-select: none; + /* label 默认 inline,内部 checkbox 是 inline-block 会受 line-height 撑出 + 基线间距导致 checkbox 在 label 内偏上。用 flex 居中并清零行高, + 让 checkbox 严格在 label 盒子中心。 */ + display: flex; + align-items: center; + line-height: 0; } .tiptap-editor ul[data-type="taskList"] li > label input[type="checkbox"] {