Skip to content

feat: compact (reading) view mode for Step block#67

Merged
littlefrontender merged 2 commits into
masterfrom
feat/step-compact-mode
Jun 8, 2026
Merged

feat: compact (reading) view mode for Step block#67
littlefrontender merged 2 commits into
masterfrom
feat/step-compact-mode

Conversation

@DavertMik

@DavertMik DavertMik commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
image

Summary

Adds a third compact view mode for the Step block, alongside the existing vertical and horizontal modes. Compact is reading-focused: each step renders as a tight row (number + content) with no per-step "Step" header, no formatting toolbar, and no Add Step / Step data / Expected result buttons.

Clicking into any editable field expands that step to the full normal editing layout and collapses it again on blur — with no layout jump. The OverType editors stay mounted across the transition, so the caret is preserved.

The per-step view-toggle now cycles vertical → horizontal → compact.

Details

  • Reading rows hug a single line: in compact, OverType's baked-in 4rem min-height floor is dropped via live options.minHeight + textarea rows=1, plus higher-specificity CSS to beat OverType's runtime-injected min-height: 60px.
  • The expected-result line is prefixed with a small inline "Expected" label while reading — a preview pseudo-element, so it never enters the serialized markdown.
  • Bug fix: the Markdown preview / Blocks JSON panels weren't updating. A deferred BlockNoteView mount (uncommitted in the working tree) broke the useEditorChange subscription. The view now renders immediately; the EditorErrorBoundary is kept for crash recovery.

Testing

  • tsc -b clean, vite build succeeds, all 158 unit tests pass.
  • Verified in a real browser (headless Chrome via CDP): mode cycling, collapse/expand with 0px focus jump on the field/text/toggle, the inline "Expected" label, tight one-line rows, and live preview updates.

🤖 Generated with Claude Code

Add a third Step view mode alongside vertical and horizontal. In compact mode
each step renders as a tight, reading-focused row (number + content; no per-step
header, no formatting toolbar, no Add Step / Step data / Expected result
buttons). Focusing an editable field expands that step to the full editing
layout and collapses it on blur with no layout jump — the OverType editors stay
mounted so the caret is preserved.

- Cycle the per-step view toggle through vertical -> horizontal -> compact.
- Drop OverType's 4rem min-height floor in compact so reading rows hug a single
  line (live options.minHeight + textarea rows=1, plus higher-specificity CSS
  to beat OverType's runtime-injected min-height: 60px).
- Prefix the expected-result line with a small inline "Expected" label while
  reading (preview pseudo-element, never serialized).
- Fix Markdown preview not updating: the deferred BlockNoteView mount broke the
  useEditorChange subscription; render the view immediately (keeping the
  EditorErrorBoundary for crash recovery).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 3, 2026

Copy link
Copy Markdown

Deploying blocks with  Cloudflare Pages  Cloudflare Pages

Latest commit: 79b8639
Status: ✅  Deploy successful!
Preview URL: https://db30d142.blocks-cno.pages.dev
Branch Preview URL: https://feat-step-compact-mode.blocks-cno.pages.dev

View logs

Resolve conflicts after master gained the TestMeta block (#65) and the
large-paste perf work (#66, per-block lazy mount via useDeferredMount).

- App.tsx: take master's version. My branch's App.tsx changes (the
  EditorErrorBoundary + removing a deferred BlockNoteView mount) are obsolete:
  master never committed that deferred mount, so it renders the view directly
  and the Markdown preview already updates correctly. The error boundary is
  dropped to match master.
- step.tsx / styles.css: auto-merged — the compact view mode (inner
  TestStepContent render) and the deferred-mount wrapper (TestStepBlock /
  TestStepPreview) live at different layers and compose cleanly.

Verified: tsc clean, 175 tests pass, and in-browser both vertical and compact
modes work (compact collapse/expand has 0px focus jump, toolbars/headers gate
correctly) with the live Markdown preview and no console errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@littlefrontender littlefrontender merged commit d5aa2e9 into master Jun 8, 2026
3 checks passed
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.

2 participants