feat(outline): outline type + outliner — S3 (#109)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Dedicated block surface (ADR-0013, #105 variant B): OutlineTree parses/serializes plain nested-bullet markdown leniently and normalizes on save; the outliner promotes one NSTextView over the focused row with LogSeq-style keys (Tab/⇧Tab, ⌥↑/⌥↓ subtree move, ↑/↓ hop, ⇧↑/⇧↓ block selection, ⌘↑/⌥↓ fold, Enter split), folds session-scoped by runtime node UUID. New Outline ⇧⌘N stages a type: outline draft through the existing autosave/conflict machinery; reading renders the serialized markdown unchanged. Outline rows use the body face at its natural line box — the prose CSS-1.8 lineHeightMultiple grew the focused row and detached the bullet (test-pinned). Finish-audit fixes included: paste-multiline sanitizing at setText, dead Enter disjunct, dead Row.path. Closes #109
This commit is contained in:
1 parent
e55747e7fe
commit
c23ee0f62f
21 files changed
+1809
-21
No files matched your search
@@ -112,6 +112,46 @@ private func makeModelHome() throws -> (PostsModel, URL) {
|
||||
#expect(model.session?.folderURL.path.contains("projects/posts/\(post.id)") == true)
|
||||
}
|
||||
|
||||
@Test @MainActor func `newOutline stages an outline draft in the target project`() async throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
let post = try PostStore.writeNew(body: "# Seed\n", project: "essays", home: home)
|
||||
// targetProject reads `posts` — wait for the bind rescan to surface the
|
||||
// piece (the watcher path; saveDraft would trigger it too, too late here).
|
||||
for _ in 0 ..< 250 where !model.posts.contains(where: { $0.id == post.id }) {
|
||||
try await Task.sleep(nanoseconds: 20_000_000)
|
||||
}
|
||||
model.select(post.id, home: home)
|
||||
|
||||
model.newOutline()
|
||||
|
||||
#expect(model.draft?.text == "- ")
|
||||
#expect(model.draft?.type == .outline)
|
||||
#expect(model.draft?.project == "essays") // selected non-archived post's project
|
||||
#expect(model.selectedPostID == nil)
|
||||
#expect(model.session == nil)
|
||||
}
|
||||
|
||||
@Test @MainActor func `newOutline draft falls back to the default project`() throws {
|
||||
let (model, _) = try makeModelHome()
|
||||
model.newOutline()
|
||||
#expect(model.draft?.project == Post.defaultProject)
|
||||
}
|
||||
|
||||
@Test @MainActor func `saveDraft materializes an outline and opens the session on it`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
|
||||
model.newOutline()
|
||||
model.saveDraft(home: home)
|
||||
|
||||
#expect(model.draft == nil)
|
||||
#expect(model.lastError == nil)
|
||||
#expect(model.session?.postID == "untitled") // "- " slugs to untitled
|
||||
#expect(model.selectedPostID == "untitled")
|
||||
let scanned = try #require(Post.scan(home: home).first)
|
||||
#expect(scanned.type == .outline)
|
||||
#expect(scanned.title == "-") // prose semantics: first line, trimmed — "- "
|
||||
}
|
||||
|
||||
@Test @MainActor func `moveTargets lists empty projects from disk`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
try PostStore.createProject(named: "essays", home: home) // empty — no pieces
|
||||
|
||||
Reference in new issue
Block a user