feat(outline): mixed-content open guard — S7 (#111)
CI / ci (push) Canceled after 0s

Opening a type: outline piece whose body parses with dropped prose
(paragraph lines between bullets) now asks before the outliner mounts:
Open in Prose (default, nothing drops), Open as Outline (explicit
consent to save normalization), or Cancel. The detector shares the
parser's item definition, the ask presents over an empty editor so
nothing can normalize on save before the choice, and the prose answer
rides a routing override that dies with the next open.

Audit round pinned the lifecycle: reselect of the open piece is a
no-op (an armed debounce must never flush mid-ask), and a draft or
guest staged during the ask displaces it without being destroyed.

Closes #111

[Generated by AI]
This commit is contained in:
AlexKucera committed 2026-10-15 18:31:26 +02:00
1 parent c23ee0f62f
commit 0b172f73ef
12 files changed
+440 -17

No files matched your search

+16
View File
@@ -32,6 +32,22 @@ nonisolated struct OutlineNode: Identifiable, Equatable {
/// All ops are path-addressed (`[Int]` root→leaf indices) and return the
/// moved node's new path, or nil when the op is a boundary no-op.
nonisolated enum OutlineTree {
/// #111: would parse drop content? True when any NON-BLANK line after
/// the first item isn't an item line — the prose the outliner can't
/// show and the next save would silently drop. Blank lines don't count:
/// they're formatting, not prose, and normalize quietly.
static func parsesWithLoss(_ markdown: String) -> Bool {
var sawItem = false
for line in markdown.split(separator: "\n", omittingEmptySubsequences: false) {
if parseItem(String(line)) != nil {
sawItem = true
} else if sawItem, !line.trimmed().isEmpty {
return true
}
}
return false
}
/// Lenient parse. Returns verbatim preamble lines (before the first item)
/// + the node tree. `-`/`*` markers followed by whitespace, any indent
/// (tab = 2 spaces, depth = width/2), depth clamps to previous + 1;