feat: add two- and three-page layouts for ultrawide displays - #67
feat: add two- and three-page layouts for ultrawide displays#67popeye001 wants to merge 5 commits into
Conversation
orange2ai
left a comment
There was a problem hiding this comment.
这个 PR 的工程质量整体不错:默认 continuous 模式零侵入我已复验(所有新路径 gated 在 paged 状态,continuous 下连 preventDefault 都不触发)、进度跨 source-mode 保留、打印导出隔离、prefers-reduced-motion 都考虑了,类型检查与构建通过。双页/三页阅读对超宽屏是真实场景。
但合并前有一个正确性缺陷和两个必须明确的问题:
1(必须):多栏模式没有任何滚动 re-snap 机制
这是分页模式下必然触发的缺陷,不是边缘 case:
- 文档内锚点跳转 [editor.ts:390] 直接
scrollIntoView,会把内层横向 scroller 滚到标题所在列左缘——落在两个 spread 之间且无 re-snap,视图永久错位半页。同类入口大纲点击([main.ts:292])和搜索([search-panel.ts:190])都适配了,唯独锚点链接漏了。 - 没有任何 scroll listener 对内层 scroller 做对齐校正。ProseMirror 自身的
scrollIntoView(undo/redo、文末输入、[mermaid-view.ts:105] 的tr.scrollIntoView())和拖拽选区越出视口的原生自动滚动,都会把视图停在未对齐位置。
请补一个统一的 re-snap 机制(scroll 事件里校正到最近 spread),并给锚点跳转走 revealElement。
2(必须):design.md 的新增条款未被批准
[design.md:47-50] 向规范追加了 4 条条款,其中「不做逐列自由滚动」实际上把缺陷写成了规范——多栏模式下所有 wheel 事件被 preventDefault([page-layout.ts:230-249]),包括 deltaX,导致宽代码块/宽表格连横向滚动都做不到,只能靠方向键。请:
- 从本 PR 移除 design.md 改动(规范变更需维护者在 issue 里逐条确认,不走 PR 自带);
- wheel 处理放行 deltaX,允许横向滚动被限宽的内容。
3(必须):补 IME 与跨列选区的实测记录
CSS multicol + contenteditable 是 Chromium 已知脆弱区:跨列选区 rects 可能为空/反转,drawSelection/coordsAtPos 视觉可能错位,跨列上下键依赖 endOfTextblock 启发式。请在 PR 描述附上中文 IME 输入、跨列选区、跨列光标移动三项的手工测试结果,附录屏或截图。
4(建议,不阻塞)
- 文件热更新(核心卖点)在多栏下列重排没有滚动位置保持,外部 Agent 改文件后读者位置直接失效,后续至少做列级 clamp。
currentPageLayout主进程单例导致多窗口菜单勾选态互相串——继承自现有 theme 的同一模式,不算本次新增问题,但若顺手可一并修。
处理完 1、2、3 即可合并。
|
复核更新:三项必改中两项已确认落实,质量很好——
另外两个 caret 修复(ae0939b、838818c)实现正确:窄门控(仅 paged、 补上第 3 项即可合并。 |
|
维护者决定不做这个功能,关闭本 PR。 方向本身实现质量很高——尤其后续几轮补的滚动 re-snap、跨栏光标移动、caret 定位都是扎实的工作,这点没有争议。但产品层面判定它超出 ColaMD 的边界:
决定已记录在 |
Summary
Design
The editor remains a single ProseMirror document. CSS columns provide the visual pagination, so Markdown serialization, editing, autosave, file watching, and agent sync continue to use the existing document model. The selected layout is persisted locally and continuous scrolling remains the default.
Paged layout classes are excluded from HTML/image export snapshots, and print styles explicitly restore the existing single-column export layout.
Review follow-up
The requested changes from the first review are now on the branch:
design.mdadditions from this PRVerification
npx tsc --noEmit -p tsconfig.main.jsonnpx tsc --noEmit -p tsconfig.preload.jsonnpx tsc --noEmit -p tsconfig.renderer.jsonnpm run check:theme-colorsnpm run buildscrollLeftstayed aligned)The packaged-app manual evidence requested in the review (macOS Chinese IME, cross-column selection, and cross-column caret movement) will be appended before requesting re-review.
An initial packaged-app caret pass exposed the overscrolling issue above; it is fixed in
838818cand now has an explicit scroll-position regression assertion. The post-fix packaged-app manual pass remains pending and is not being claimed as complete here.This PR contains no product-name, bundle-ID, packaging, updater, or local-path changes.