feat(editor): configurable text flow — line height + spacing knobs (#71 follow-up 7)

Three UserDefaults-backed knobs in ProseTypography (line-height multiple,
space-after-¶ and space-after-heading in body lines, clamped), surfaced
in Settings → Text Flow. Also fixes two real bugs from the last commit:
paragraphSpacing was set to 1.25 POINTS (now lines × linePoints), and
reading-mode body paragraphs never received the rhythm at all (they rode
the editing surface's fixed 10pt) — both surfaces now share one rhythm.
This commit is contained in:
AlexKucera committed 2026-10-06 13:43:43 +02:00
1 parent 2d4e2563f7
commit 6d7d1411a2
4 files changed
+98 -5

No files matched your search

+5 -3
View File
@@ -42,10 +42,12 @@ nonisolated enum ProsePresenter {
/// as body anyway; dedicated quote spacing waits for #20's polish pass.
static func paragraph(_ kind: LineKind) -> NSParagraphStyle {
let style = NSMutableParagraphStyle()
style.lineHeightMultiple = ProseTypography.lineHeightMultiple
let line = ProseTypography.linePoints
switch kind {
case .heading1: style.paragraphSpacing = 18; style.paragraphSpacingBefore = 26
case .heading2: style.paragraphSpacing = 12; style.paragraphSpacingBefore = 20
case .quote, .syntaxOnly, .body: style.paragraphSpacing = 10
case .heading1: style.paragraphSpacing = 2 * line; style.paragraphSpacingBefore = 26
case .heading2: style.paragraphSpacing = 2 * line; style.paragraphSpacingBefore = 1 * line
case .quote, .syntaxOnly, .body: style.paragraphSpacing = 1 * line
}
return style
}