Repository navigation
MarkdownAura v1.5.3
MarkdownAura 1.5.3
编辑模式下,光标所在的那一行现在被标了出来。 进入编辑(ctrl E)本来只有三处信号:药丸变成
editing、窗格底色从 --code 换成 --bg、出现光标。光标停在哪一行要靠自己找;现在那行有底色,它的行号
也从 --tx-3 提到 --tx-2。这是对已有模式的一处补强,不是新能力。
- 两半是同一个动作,分别给文字和行号。
highlightActiveLine()给行元素加cm-activeLine,
highlightActiveLineGutter()给它的行号格加cm-activeLineGutter。行号格只提亮字色、底色仍是
透明——给它填色会在阅读栏旁边多出一列色带,而这一格本来只承担"参照"。 - 颜色是新令牌
--active-line,不是强调色。 亮色rgba(0, 0, 0, .045)、暗色
rgba(255, 255, 255, .05),各自叠在窗格底色--bg上(合成后 #f4f4f4 / #2b2a2e,两套的步进
恰好都是每通道 11/255)。刻意不用--ac-bg:这一格里强调色已经表示选中,当前行同色会把落在这行上的
选区吞掉(暗色下两者只差一档),也违背 SPEC §8 的"一个强调色"。行与行号的值全部住在
design/tokens.css/design/components.css,所以换主题不需要任何 JavaScript。 - 只读态一行代码没动。 编辑器只在编辑模式里在场(只读态是那个
<pre>),所以当前行高亮不可能漏进
读者的干净栏位,也不需要额外的开关。 .cm-line写进选择器是有原因的。 CodeMirror 自带规则是&light .cm-activeLine(两个类)并涂固定
的#cceeff44,在两个主题上都不对;同类数下我们只赢在样式表顺序上,而颜色不该依赖顺序。加上.cm-line
成为三个类,结果与顺序无关。- 没有新设置、没有存储格式变化、没有渲染器改动。 只动
src/ui/editor.ts的扩展表、两个设计文件
(tokens.css、components.css)、SPEC §12 与两份 README 的编辑行。
验证:这是 §12 里第一个不用 Tauri 外壳验证的改动,用的是 IMPL §10 的方法——var/ 下的临时页
(已删)通过 dev server 加载真实的 src/ui/editor.ts 与真实的样式表,按 index.html 的容器标记
挂载两个窗格,全部实测而非读代码:编辑态首帧(状态刚由 show 建出、focus 后没有任何派发)当前行已经
带上类,说明它来自插件自己的初次计算;两个窗格各自只有一行被标(源码栏 15px、分栏 13.005px);类落在
.cm-line 上、行号类落在 .cm-gutterElement 上;revealRange 一动它就跟着走;两种主题令牌都解析成
rgba(0, 0, 0, .045) / rgba(255, 255, 255, .05),而不是 CodeMirror 自己的 #cceeff44(那正是"输在
它对等规则上"的样子);合成后的一步之差是像素事实,由截图与 Chromium 自身的合成量出。npx tsc --noEmit
干净,design/check-prose-css.mjs 与 design/check-raw-html.mjs 两个设计闸门通过。
mockup 的 <textarea> 显示不了当前行(包住它的是高亮层,不是排版引擎),SPEC §12 已把它记为 mockup 的
第三处"假"。
The editable pane now marks the line the caret is on. Entering the mode (ctrl E) used to give three
signals — the pill reading editing, the pane's background stepping from --code to --bg, and a caret —
and finding which line you were on was left to your eye. That line now carries a tint, and its number in the
gutter steps from --tx-3 to --tx-2. A refinement inside a mode that already exists, not a new capability.
- One thing in two halves, for the text and for the number.
highlightActiveLine()adds
cm-activeLineto the line element,highlightActiveLineGutter()addscm-activeLineGutterto its gutter
cell. The cell only brings forward its colour and stays transparent — filling it would put a second column
of colour beside the reading column, and that cell is a reference, not content. - The colour is a new token,
--active-line, and it is deliberately not the accent.rgba(0, 0, 0, .045)
light andrgba(255, 255, 255, .05)dark, each over the pane's--bg(#f4f4f4 / #2b2a2e once
composited, an 11/255 step per channel in both). The accent already means selected in this pane, so a
current line in--ac-bgwould swallow the selection sitting on it (the two are one step apart in dark),
and §8's one-accent rule says nothing else is saturated. Every value lives indesign/tokens.css/
design/components.css, so a theme switch needs no JavaScript at all. - The read-only state is untouched. The editor is only on screen while the mode is on (read-only is a
<pre>), so the tint cannot leak into the reader's clean column and needs no switch of its own. .cm-lineis in the selector on purpose. CodeMirror's own rule is&light .cm-activeLine(two classes)
painting a fixed#cceeff44, wrong on both themes; at equal specificity we would only win on stylesheet
order, and a colour should not depend on order. Three classes makes the outcome order-independent.- No new setting, no storage change, no renderer change. Only the extension list in
src/ui/editor.ts,
the two design files (tokens.css,components.css), SPEC §12 and the editing row in both READMEs.
Verified — the first change to §12 that was driven without the Tauri shell, using IMPL §10's method: a
throwaway page under var/ (since deleted) loaded the real src/ui/editor.ts and the real stylesheets
through the dev server, mounted both panes into the app's own container markup, and measured rather than read:
the mode's first frame (state just created by show, focused, no dispatch at all) already carries the
class, so it comes from the plugin's own initial computation; exactly one line per pane is marked (source pane
15px, split pane 13.005px); the classes land on the .cm-line element and the .cm-gutterElement cell; the
tint follows revealRange; and the token resolves to rgba(0, 0, 0, .045) / rgba(255, 255, 255, .05) in the
two themes instead of CodeMirror's #cceeff44 — which is exactly what losing the tie would have looked like.
The one-step difference is a pixel fact, so it was measured too: by screenshot, and through Chromium's own
compositing. npx tsc --noEmit is clean and both design gates (check-prose-css.mjs, check-raw-html.mjs)
pass. The mockup's <textarea> cannot show a current line (it sits over a highlighter, not a layout engine),
which SPEC §12 now records as the mockup's third fake.