feat(editor): markdown edit mode — direct document editing with diff-to-agent feedback#890
Open
backnotprop wants to merge 2 commits into
Open
feat(editor): markdown edit mode — direct document editing with diff-to-agent feedback#890backnotprop wants to merge 2 commits into
backnotprop wants to merge 2 commits into
Conversation
…to-agent feedback Adds an Edit toggle to the plan/annotate UI that swaps the Viewer for a CM6 live-preview editor (@atomic-editor/editor, Obsidian-style: raw markdown is the source of truth, rendering is decoration-only). On submit, user edits travel as a 'Direct Edits' unified diff through the existing feedback channels — works on every surface including plan mode, where no file exists. Zero server changes. - Edit toggle in the Wide/Focus switcher row; toolstrip hidden while editing - Committed edits surface as a pinned card in the annotations sidebar (+N/−M, expandable diff, two-step discard); panel auto-opens on commit - Edits count as feedback in every submit gate (approve warning, Send Feedback routing, Cmd+Enter router, annotate gate mode) - Annotations re-anchor by text search after edits; stale block anchors remapped, vanished text reported via toast - Theme bridge maps --atomic-editor-* vars to Plannotator tokens (dark + light, including the specificity override atomic's light palette needs) - Fidelity test: byte-identical load→read round-trips on 3 PFM fixtures + a 150-file sample of real plan history (DOM_TESTS=1 bun test, happy-dom preload is opt-in so server-oriented tests keep native globals) - Bundle delta: +682 KB raw / +236 KB gzip on the single-file hook HTML Part of #887
Closed
10 tasks
The editor component now ships as a standalone public package (github.com/plannotator/markdown-editor, npm @plannotator/markdown-editor) so other apps and the enterprise standalone can reuse it. The monorepo keeps a ~40-line theme-bridging shim: App.tsx renders ThemeProvider inside its own JSX, so the resolved color mode is read beneath the provider and passed to the package as a prop; gridEnabled maps to the package's cardClassName with the design-system utilities. - bunfig: @plannotator/markdown-editor added to minimumReleaseAgeExcludes (same first-party exception as @pierre/diffs) - local markdown-editor.css deleted after diff-verification against the published dist (all 24 variable declarations + light-mode block + transition rule byte-identical) - gates unchanged: fidelity corpus 4/4, build delta +0.4 KB, suite at baseline Tracked in plannotator/markdown-editor#1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #887 (Phase 1). Closes the core ask from #424.
What this is
An Edit toggle in the plan review / annotate UI that swaps the rendered Viewer for a live-preview markdown editor — Obsidian-style: syntax shows on the active line, renders everywhere else. The raw markdown text is the source of truth; rendering is purely view-layer decorations (atomic-editor, CM6-based).
Preview:
editor2.mp4
How edits reach the agent
On Approve / Request Changes / Send Annotations, a "Direct Edits" section — a unified diff against the as-submitted document — is prepended to the feedback and rides the existing channels. Zero server changes; works on every runtime (Bun + Pi parity verified by inspection), and crucially works in plan mode where there is no file to write.
+N/−M, expandable inline diff, two-step discard; the panel auto-opens on commitWhy this editor (and not Milkdown/ProseMirror)
Parse→regenerate editors normalize markdown on serialize (bullet markers, escaping, spacing), so a one-word edit produces a noisy diff that would mislead the agent. atomic-editor keeps the document byte-for-byte and decorates the view instead. That property is enforced by test:
Fidelity guarantee
packages/ui/markdownEditorFidelity.test.tsxmounts the editor and assertsgetMarkdown()is byte-identical to the input — across 3 synthetic PFM-torture fixtures (committed) plus a deterministic 150-file sample of real plans from~/.plannotator/history(runtime-only, skips on CI). Run:DOM_TESTS=1 bun test markdownEditorFidelity. The happy-dom preload is opt-in viaDOM_TESTS=1so server-oriented tests keep native globals.Gating
Edit is available only on the main plan / annotate-file markdown: hidden in archive, HTML render, plan diff, linked docs, message picker, folder browser (pre-selection), shared sessions, and after submit. Sidebar file/archive selection is blocked with a toast while an edit session is open.
Numbers
@atomic-editor/editor+ CM6 peers inpackages/uiKnown deferrals (tracked in #887 Phase 2+)
:::callouts, wiki-links) renders as plain text inside the editor; rendered view is unaffectedannotateon local files (Phase 3); review-surface edits (Phase 4)