Skip to content

Paint slides text-box edit mode in the deck theme color#300

Merged
hackerwins merged 1 commit into
mainfrom
fix-slides-textbox-edit-theme-color
May 25, 2026
Merged

Paint slides text-box edit mode in the deck theme color#300
hackerwins merged 1 commit into
mainfrom
fix-slides-textbox-edit-theme-color

Conversation

@hackerwins

@hackerwins hackerwins commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Entering text-box edit mode on a dark deck theme (e.g. Simple Dark)
painted the text black/invisible.

Slides text renders through two paths that must agree on color:

  • Committed slide canvas (drawText) builds a theme-aware
    colorResolver (makeColorResolver) that remaps the docs-default
    '#000000' and undefined inline colors to the deck's text role
    color (a light ink in dark themes).
  • In-place editor (initializeTextBoxpaintLayout) was called
    with no colorResolver, so it fell back to the docs
    defaultColorResolver (literal black). The docs editor seeds new
    inlines with DEFAULT_INLINE_STYLE.color = '#000000'.

Result: text turned black the moment you entered edit mode.

Fix

Thread a colorResolver end-to-end:

  • packages/docs/.../text-box-editor.ts — add colorResolver? to
    TextBoxEditorOptions; pass it into the paintLayout call.
  • packages/slides/.../canvas/text-renderer.ts — export the existing
    makeColorResolver (reused, not duplicated, so canvas + editor stay
    single-sourced).
  • packages/slides/.../editor/text-box-editor.ts — add colorResolver?
    to MountSlidesTextBoxOptions; forward it.
  • packages/slides/.../editor/editor.tsenterEditMode builds the
    resolver from the active theme (makeColorResolver(getActiveTheme(doc))).

colorResolver is optional everywhere, so docs/sheets callers fall back
to defaultColorResolver (string passthrough) unchanged.

Test plan

  • New regression test in slides/test/view/editor/text-box-editor.test.ts:
    in a default-dark deck, edit mode receives a resolver that maps both
    '#000000' and undefined to the theme text color. Proven to fail
    without the fix (colorResolver undefined), passes with it.
  • pnpm verify:fast green (frontend / backend / sheets / slides / cli / docs).
  • Pending: manual smoke in pnpm dev with Simple Dark.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed text visibility in dark-theme slide editing where in-place editor text would become invisible, ensuring theme colors are correctly applied when editing slide text.

Review Change Stack

Entering text-box edit mode on a dark deck theme (e.g. Simple Dark)
painted the text black/invisible. The committed slide canvas remaps the
docs-default '#000000' and undefined inline colors to the deck's text
role color via makeColorResolver, but the in-place text-box editor
called paintLayout with no colorResolver, so it fell back to the docs
default (literal black).

Thread a colorResolver through initializeTextBox and mountSlidesTextBox,
and have the slides editor build it from the active theme so edit mode
and the committed canvas paint identically. Optional everywhere, so
docs/sheets callers are unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2c845a98-a875-4d6d-bdd8-3e6ba31de4e5

📥 Commits

Reviewing files that changed from the base of the PR and between cf83a49 and c42603c.

📒 Files selected for processing (8)
  • docs/tasks/README.md
  • docs/tasks/active/20260525-slides-textbox-edit-theme-color-lessons.md
  • docs/tasks/active/20260525-slides-textbox-edit-theme-color-todo.md
  • packages/docs/src/view/text-box-editor.ts
  • packages/slides/src/view/canvas/text-renderer.ts
  • packages/slides/src/view/editor/editor.ts
  • packages/slides/src/view/editor/text-box-editor.ts
  • packages/slides/test/view/editor/text-box-editor.test.ts

📝 Walkthrough

Walkthrough

This PR fixes a dark-theme bug where text-box edit mode renders text as invisible black. The canvas and editor render paths previously used different theme color resolvers. The fix exports a reusable color resolver from the canvas renderer and threads it through the text-box editor pipeline, using the active deck theme when entering edit mode.

Changes

Slides Text-Box Dark-Theme Edit-Mode Fix

Layer / File(s) Summary
Task documentation and root cause analysis
docs/tasks/README.md, docs/tasks/active/20260525-slides-textbox-edit-theme-color-*.md
Task documents explain the dual render-path color resolution mismatch, validation via regression test, and development gotchas related to build artifacts and theme lookup safety.
Export resolver and thread through docs text-box-editor
packages/slides/src/view/canvas/text-renderer.ts, packages/docs/src/view/text-box-editor.ts
makeColorResolver is exported; TextBoxEditorOptions gains optional colorResolver field and threads it into paintLayout during render.
Wire colorResolver through slides text-box-editor wrapper
packages/slides/src/view/editor/text-box-editor.ts
MountSlidesTextBoxOptions accepts and destructures colorResolver, passing it to initializeTextBox.
Integrate theme-aware resolver at edit-mode entry point
packages/slides/src/view/editor/editor.ts
Editor imports theme helpers, derives active theme in enterEditMode, and passes a theme-aware colorResolver to mountTextBox.
Regression test for theme-aware color resolution
packages/slides/test/view/editor/text-box-editor.test.ts
Test verifies that in dark theme, the mounted editor's colorResolver maps both '#000000' and undefined to the theme's text color.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A textbox lost in darkness deep,
Two render paths that wouldn't keep,
Now theme and color dance as one,
Through threads of light from theme to sun! 🌙✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and concisely describes the main change: enabling slide text-box edit mode to render using the deck's theme color.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-slides-textbox-edit-theme-color

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 233.8s

Lane Status Duration
tokens:build ✅ pass 2.1s
sheets:build ✅ pass 12.5s
docs:build ✅ pass 12.5s
slides:build ✅ pass 14.1s
verify:fast ✅ pass 148.8s
frontend:build ✅ pass 19.1s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 5.0s
cli:build ✅ pass 2.1s
verify:entropy ✅ pass 17.2s

Verification: verify:integration

Result: ✅ PASS

@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/docs/src/view/text-box-editor.ts 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hackerwins
hackerwins merged commit 5db952b into main May 25, 2026
4 checks passed
@hackerwins
hackerwins deleted the fix-slides-textbox-edit-theme-color branch May 25, 2026 15:32
hackerwins added a commit that referenced this pull request May 25, 2026
These tasks landed on main per recent commit log: docker-publish-arm64
(#296), import-progress-toast (#299), pptx-blipfill-fillrect-crop (#297),
release-v0.4.2 (#295), slides-textbox-autogrow (cf83a49), and
slides-textbox-edit-theme-color (#300). Move their docs to
archive/2026/05 and regenerate the task indexes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
hackerwins added a commit that referenced this pull request May 25, 2026
These tasks landed on main per recent commit log: docker-publish-arm64
(#296), import-progress-toast (#299), pptx-blipfill-fillrect-crop (#297),
release-v0.4.2 (#295), slides-textbox-autogrow (cf83a49), and
slides-textbox-edit-theme-color (#300). Move their docs to
archive/2026/05 and regenerate the task indexes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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