diff --git a/src/server/routes/note.ts b/src/server/routes/note.ts index 0415cc5..8cd597c 100644 --- a/src/server/routes/note.ts +++ b/src/server/routes/note.ts @@ -12,7 +12,13 @@ import { parseNoteFormFields, } from "../../lib/orchestrators/note.ts"; import { htmlResponse } from "../../lib/response.ts"; -import { collabWsPath, noteUrl, redirect, wikiUrl } from "../../lib/urls.ts"; +import { + collabWsPath, + editNoteUrl, + noteUrl, + redirect, + wikiUrl, +} from "../../lib/urls.ts"; import { editNotePage } from "../../views/edit-note.ts"; import { HISTORY_PAGE_SIZE, @@ -59,7 +65,9 @@ export const noteRoutes = new Elysia() try { const { noteSlug } = await createNoteAction(ctx, fields, msg); - return redirect(noteUrl(ctx.ownerHandle, ctx.wiki.slug, noteSlug)); + // Drop the author straight into the live collaborative editor: the note + // now exists on the wiki, and its body is written there, not here. + return redirect(editNoteUrl(ctx.ownerHandle, ctx.wiki.slug, noteSlug)); } catch (err) { if (err instanceof ValidationError) { return htmlResponse( diff --git a/src/views/new-note.ts b/src/views/new-note.ts index 96b3d1d..cc388dc 100644 --- a/src/views/new-note.ts +++ b/src/views/new-note.ts @@ -29,28 +29,17 @@ export function newNotePage( const titleValue = escapeHtml(options?.titleValue ?? ""); const escapedContent = escapeHtml(options?.contentValue ?? ""); - // Editor/preview sizing is owned by editor.ts (shared with the edit page), so - // there's no page-local height hack here anymore. + // Creation captures only a title (optionally pre-filled by importing a file). + // The body is authored afterwards in the collaborative editor, so the content + // field here is hidden — it exists solely to carry imported file text to the + // server. initFileImport() in editor.ts fills it; initEditor() skips it because + // it is display:none, so no solo CodeMirror is mounted on this page. return layout( `${msg.wiki.newNote} — ${wiki.name}`, `

${msg.wiki.newNote}

${errorHtml} -
- - -
- - -
-
-
+
- - -
-
- + +
+ + +
- +
- + ${msg.editor.cancel}
diff --git a/tests/integration/http-roundtrip.test.ts b/tests/integration/http-roundtrip.test.ts index 538de0b..820add6 100644 --- a/tests/integration/http-roundtrip.test.ts +++ b/tests/integration/http-roundtrip.test.ts @@ -111,7 +111,8 @@ describe("HTTP forward flow: user → route → orchestrator → DB", () => { }); expect(createRes.status).toBe(302); const noteLocation = createRes.headers.get("location"); - expect(noteLocation).toBe(`/@${handle}/${wikiSlug}/first-note`); + // Creation lands in the collaborative editor, not the read view. + expect(noteLocation).toBe(`/@${handle}/${wikiSlug}/first-note/edit`); const initial = getCurrentNote(wiki.at_uri, "first-note"); expect(initial?.content).toBe("Initial content"); diff --git a/tests/server/routes/note.test.ts b/tests/server/routes/note.test.ts index 69342ff..651d123 100644 --- a/tests/server/routes/note.test.ts +++ b/tests/server/routes/note.test.ts @@ -116,7 +116,9 @@ describe("note routes", () => { }), ); expect(res.status).toBe(302); + // Creation now drops the author straight into the collaborative editor. expect(res.headers.get("Location")).toContain(`/@${TEST_DID}/${SLUG}/`); + expect(res.headers.get("Location")).toContain("/edit"); }); test("POST /@handle/:slug/new with empty title returns validation error", async () => {