Repository navigation
MarkdownAura v1.5.4
MarkdownAura 1.5.4
阅读宽度(窄 / 舒适 / 撑满)现在对代码区和渲染区是同一个行为。 此前 --measure 只落在渲染区
(.prose > *)和编辑态的代码栏(.cm-content)上:分屏时右半随预设变窄、左半仍是整个窗格宽;源码视图
更彻底——那个视图里两个渲染窗格都是 display: none,src/measure.ts 找不到可度量的 .prose,于是
在源码视图里改预设对眼前的窗格毫无作用(任何窗口宽度都一样)。
- 一条规则,四个栏面。
.source-view pre与.view.split .pane-src pre现在和渲染区一样带
max-width: var(--measure)+margin-inline: auto;编辑态本来就是同一个 token(.cm-editor .cm-content),所以只读态切成编辑态不再让文字换行位置动一下。 - 接受一个已写明的后果:token 是按正文字体解析的像素值,源码窗格是等宽字体,所以同一个预设
给出同一个像素栏宽、只是每行字符数不同(components.css与 SPEC §3 都写着)。这是"两半同栏、
屏幕上只有一个数字"的代价,也是分屏两半能对齐的前提。 - 源码视图补了一块"可度量表面"。 该视图新增一个空的、离屏的
.prose.measure-host(index.html),
因为ch预设必须有已布局的.prose才能解析:它用visibility: hidden而不是display: none
(后者会让它不可度量),并且是绝对定位——每个视图都是 flex 行,一个带margin-inline: auto的
空流内项会把自由空间吃掉。 - mockup 的那套假编辑器跟着修。 栏放在
.editor(两层共同的容器)而不是<textarea>上:后者是
block formatting context,要避开readonly-pill的浮动,auto 边距因此按"窗格减掉药丸"求解
(实测左 107px / 右 167px),光标相对字形漂 31px。mockup 的resolveMeasure原来硬编码
#out-preview(在预览之外的视图里是display: none,量到 0),现在与src/measure.ts一致:第一个
已布局的.prose。 - 没有新设置、没有存储变化、没有渲染器改动。 动的是两个设计文件、
index.html、src/measure.ts
的注释,以及两份 README 的阅读行。
验证(实测,不是读代码):应用前端跑在 Chromium + Vite dev server 上(真实的 index.html、
main.ts、measure.ts、真实样式表),用真实的 ctrl shift M 走 setMeasure → applyLayout → applyMeasure;分屏里给两个窗格都放上内容后,三档下代码栏与渲染栏逐档相等:窄 420 / 420、
舒适 809 / 809、撑满 1025 / 1025。源码视图里改预设现在真的会动(485 / 809 / 全窗格),此前三档都是
976。mockup 里同一套断言在只读态与编辑态都成立(源码视图 485/809/976,分屏 420/465/465,textarea 与
高亮层同框同宽)。design/check-prose-css.mjs 新增 7 条断言(四个栏面 + 宿主存在且不可 display: none),
并做了反向验证:清空那条栏规则会得到 2 条 FAIL,删掉宿主会得到 3 条 FAIL。npm run typecheck、
check:prose、check:rawhtml 三个闸门通过。
The reading width (narrow / comfortable / full) now behaves the same in the code pane and the rendered
pane. --measure used to reach only the rendered pane (.prose > *) and the editable code column
(.cm-content): in a split the render half narrowed with the preset while the source half stayed the full
width of its pane, and the source view was worse — with it up, both rendered panes are display: none, so
src/measure.ts had no laid-out .prose to resolve ch against and picking a preset changed nothing at all
on the pane in front of the reader, at any window size.
- One rule, four surfaces.
.source-view preand.view.split .pane-src prenow carry the same
max-width: var(--measure)+margin-inline: autothe rendered pane uses; the editable pane already shared
the token (.cm-editor .cm-content), so entering the mode no longer moves the text. - One consequence, stated: the token is a pixel value resolved against the prose font and the source
pane is mono, so the same preset is the same pixel column with fewer characters per line (it is written
down incomponents.cssand SPEC §3). That is the price of one column and one number on screen — and what
makes the two halves of a split line up. - The source view gained a measurable surface. An empty, off-screen
.prose.measure-host(index.html),
because achpreset needs a laid-out.proseto resolve against: it hides withvisibility: hidden, never
display: none(which would make it unmeasurable), and it is absolutely positioned — every view is a flex
row, and an empty in-flow item withmargin-inline: autowould eat the free space beside it. - The mockup's faked editor follows. The column sits on
.editor, the box both layers fill, rather than on
the<textarea>: a textarea is a block formatting context that has to keep clear of thereadonly-pill
float, so its auto margins were resolved against the pane minus the pill (107px left against 167px right,
measured) and the caret drifted 31px off the glyphs. The mockup'sresolveMeasurealso hard-coded
#out-preview—display: noneoutside the preview, and therefore zero — and now matchessrc/measure.ts:
the first laid out.prose. - No new setting, no storage change, no renderer change. Two design files,
index.html, the comments in
src/measure.ts, and the Reading row of both READMEs.
Verified (measured, not read): the app front end ran in Chromium against the Vite dev server (the real
index.html, main.ts, measure.ts and stylesheets) and the real ctrl shift M path (setMeasure → applyLayout → applyMeasure). With content in both panes of a split, the code column and the render column are
equal in all three presets: narrow 420 / 420, comfortable 809 / 809, full 1025 / 1025. In the source view a
preset now moves the pane (485 / 809 / the whole pane) where all three used to be 976. The same assertions hold
in the mockup, read-only and editing (source view 485/809/976, split 420/465/465, textarea and highlight layer
in the same box at the same width). design/check-prose-css.mjs gained seven assertions (the four column
surfaces, plus the host being present and not display: none), negative-tested: emptying the column rule gives
two failures, removing the host three. npm run typecheck, check:prose and check:rawhtml pass.