diff options
| author | soryu <soryu@soryu.co> | 2026-05-08 13:42:51 +0100 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-05-08 13:42:51 +0100 |
| commit | fda983e990e4996bbbed1344cdec1e67bbeb18ae (patch) | |
| tree | f12d1e1aa25ba655966d406da58de0babc251414 /makima/frontend/src/routes/document-directives.tsx | |
| parent | 2dda1f96a30eee2fda86be9a8a59ce5cb26dad7f (diff) | |
| download | soryu-document-editor-explicit-body.tar.gz soryu-document-editor-explicit-body.zip | |
refactor(frontend): DocumentEditor takes explicit body/title/documentId propsdocument-editor-explicit-body
Stops shadowing directive.goal with the contract body via a synthesised
directive object. DocumentEditor now accepts:
* documentId — scopes the localStorage draft key per contract so
switching contracts under the same directive doesn't clobber the
other's unsaved edits.
* title — the contract title rendered as the H1.
* body — the contract body, used to seed the editor.
* onUpdateBody (was onUpdateGoal)
The `directive` prop stays for orchestrator state + embedded steps
panel. document-directives.tsx drops the directiveAsDocument synthesis
hack and passes body/title from the contract directly.
This is the prep-work for dropping `directives.goal` from the schema —
once nothing reads it, the column can be dropped in a follow-up
without touching the editor.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'makima/frontend/src/routes/document-directives.tsx')
| -rw-r--r-- | makima/frontend/src/routes/document-directives.tsx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/makima/frontend/src/routes/document-directives.tsx b/makima/frontend/src/routes/document-directives.tsx index b89e841..63d0b96 100644 --- a/makima/frontend/src/routes/document-directives.tsx +++ b/makima/frontend/src/routes/document-directives.tsx @@ -1391,17 +1391,11 @@ function EditorShell({ ); } - // Synthesise a directive-shaped object whose `goal` is the document body. - // DocumentEditor was originally written against DirectiveWithSteps, so we - // can keep its shape by overriding `goal` with `doc.body` and `title` - // with the document's filename label. The steps panel still draws from - // the real directive (passed through StepsBlockContextProvider). + // The contract title is the filename label; the contract body is the + // editor body. DocumentEditor takes these directly (no more synthesis + // hack) — `directive` is still passed for orchestrator state and the + // embedded steps panel via StepsBlockContextProvider. const docTitle = `${fileLabel(doc, directive)}.md`; - const directiveAsDocument = { - ...directive, - goal: doc.body, - title: docTitle, - }; return ( <div className="flex-1 flex flex-col h-full overflow-hidden"> @@ -1420,8 +1414,11 @@ function EditorShell({ // when the user switches documents, so the previous doc's body // doesn't bleed into the new one. key={doc.id} - directive={directiveAsDocument} - onUpdateGoal={onUpdateDocumentBody} + directive={directive} + documentId={doc.id} + title={docTitle} + body={doc.body} + onUpdateBody={onUpdateDocumentBody} onCleanup={async () => { await cleanup(); }} |
