feat(outline): mixed-content open guard — S7 (#111)
CI / ci (push) Canceled after 0s
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:
1 parent
c23ee0f62f
commit
0b172f73ef
12 files changed
+440
-17
No files matched your search
@@ -89,6 +89,17 @@ struct WorkspaceView: View {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
// #111 (S7): the mixed-content outline guard ask — presents over an
|
||||
// empty editor (select held the open; nothing can edit while it's
|
||||
// up). Prose = safe open; Outline = explicit consent to the save
|
||||
// drop; Esc/Cancel backs out with nothing opened.
|
||||
.sheet(isPresented: outlineGuardBinding) {
|
||||
OutlineGuardSheet {
|
||||
gate.posts.openGuardedOutlineInProse(home: gate.museionHome)
|
||||
} openAsOutline: {
|
||||
gate.posts.openGuardedOutlineAsOutline(home: gate.museionHome)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Collapsed floor: rail 56 + editor placeholder (export ≤920 layout).
|
||||
.frame(minWidth: 480, minHeight: 320)
|
||||
@@ -137,6 +148,18 @@ struct WorkspaceView: View {
|
||||
)
|
||||
}
|
||||
|
||||
/// #111 (S7): the outline guard ask presents while an open is held.
|
||||
private var outlineGuardBinding: Binding<Bool> {
|
||||
Binding(
|
||||
get: { gate.posts.outlineGuardPieceID != nil },
|
||||
set: {
|
||||
if !$0 {
|
||||
gate.posts.cancelOutlineGuard()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func paneContent(_ geo: GeometryProxy) -> some View {
|
||||
@Bindable var gate = gate
|
||||
@@ -359,6 +382,44 @@ private struct OriginAskSheet: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// #111 (S7): the mixed-content outline guard ask. The piece has prose
|
||||
/// lines the outliner can't show — opening it as an outline would drop
|
||||
/// them on the next save. Prose = nothing drops; Outline = the explicit
|
||||
/// choice the ruling requires.
|
||||
private struct OutlineGuardSheet: View {
|
||||
let openInProse: () -> Void
|
||||
let openAsOutline: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text("Open as outline or prose?")
|
||||
.font(.system(size: 15, weight: .semibold, design: DesignTokens.serif))
|
||||
Text("This outline has paragraph lines between its bullets. The outliner can't show them — opening as an outline drops them on the next save. Prose mode shows everything.")
|
||||
.font(.callout)
|
||||
.foregroundStyle(DesignTokens.muted)
|
||||
Text("Outline mode keeps its bullets, indentation, and folding. You can convert or clean up later.")
|
||||
.font(.callout)
|
||||
.foregroundStyle(DesignTokens.muted)
|
||||
HStack {
|
||||
Spacer()
|
||||
// Dismissal itself is the cancel (binding set(false) →
|
||||
// cancelOutlineGuard) — Esc and ⌘. land here too.
|
||||
Button("Cancel", role: .cancel) {}
|
||||
.keyboardShortcut(.cancelAction)
|
||||
Button("Open as Outline") {
|
||||
openAsOutline()
|
||||
}
|
||||
Button("Open in Prose") {
|
||||
openInProse()
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
}
|
||||
}
|
||||
.padding(20)
|
||||
.frame(width: 420)
|
||||
}
|
||||
}
|
||||
|
||||
/// #108: New Project ask — the sheet behind File ▸ New Project… (and any
|
||||
/// future materialize path). Create runs through the model's raw op; the
|
||||
/// thrown reason is shown inline and the sheet stays up.
|
||||
|
||||
Reference in new issue
Block a user