Skip to content

fix(editor): render visible highlight + popover for Flag marks - #70

Open
vishalsachdev wants to merge 1 commit into
EveryInc:mainfrom
vishalsachdev:flag-rendering
Open

fix(editor): render visible highlight + popover for Flag marks#70
vishalsachdev wants to merge 1 commit into
EveryInc:mainfrom
vishalsachdev:flag-rendering

Conversation

@vishalsachdev

Copy link
Copy Markdown

Problem

Flagging a selection via the selection bar creates a kind: 'flagged' mark (correctly anchored, saved, and counted by the heatmap gutter) but produces no visible feedback in the document — the decoration pass in createDecorations explicitly skips flagged marks:

case 'authored':
case 'approved':
case 'flagged':
    continue;

Meanwhile STYLES.flagged (the dusty-rose treatment) is defined directly above but never used. From a user's perspective the only observable effect of clicking Flag is the document saving again. Clicking an (invisible) flagged range would also open an empty "Suggestion" popover whose Apply/Reject buttons are no-ops for flagged marks.

Fix

  • src/editor/plugins/marks.ts — give 'flagged' its own decoration case (mark-flagged class, wired to the existing STYLES.flagged: 3px rose left border + pale rose background), plus a flag-specific new-mark glow keyframe (box-shadow only, mirroring delete's). Without the dedicated keyframe, the default green glow's forwards fill permanently overrides the rose tint on freshly created flags.
  • src/editor/plugins/mark-popover.ts — add a renderFlag() card: "Flagged by {actor}", body shows the flag note (or quoted text), actions are Remove flag (via deleteMark) and Close — replacing the broken empty suggestion popover.

Notes

  • The rose visual language is upstream's own dormant STYLES.flagged, just connected; the popover card follows the existing comment-card pattern.
  • npm run build clean; test suites pass at parity with baseline on our fork (no new failures). No decoration/DOM-level test harness existed to extend naturally — happy to add one if you can point at a preferred pattern.
  • Found while running Proof for real document review; flags created before the fix render correctly after it, since the data layer always worked.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ro6KiE6zCSSzsqeyVoAu8M

Flag from the selection menu wrote a proofFlagged mark to the doc but
createDecorations skipped 'flagged' entirely (case fell into the
authored/approved continue), so flagging produced zero visual feedback
even though STYLES.flagged already existed unused. Comment/Suggest were
unaffected because their kinds are handled in the switch.

- marks.ts: give 'flagged' its own decoration case (mark-flagged class,
  dusty-rose left border + tint) and a rose box-shadow-only glow for new
  flags so the forwards-filled green glow doesn't override the flag tint.
- mark-popover.ts: clicking a flagged span now shows a 'Flagged by ...'
  card (note or quote) with Remove flag / Close, instead of an empty
  Suggestion card with dead Apply/Reject.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant