Skip to content

feat(editors): let image blocks switch between URL and Slack file sources - #192

Merged
StephenTangCook merged 1 commit into
mainfrom
claude/image-block-slack-file-control-vp9egt
Aug 17, 2026
Merged

feat(editors): let image blocks switch between URL and Slack file sources#192
StephenTangCook merged 1 commit into
mainfrom
claude/image-block-slack-file-control-vp9egt

Conversation

@StephenTangCook

@StephenTangCook StephenTangCook commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an "Image source" radio (Public URL / Slack file) to the image block editor flyout, so a slack_file-backed image block can be converted to the image_url variant (and back), instead of rendering as a dead-end "not editable" message. The slack_file reference itself (File ID / File URL) plus alt text and title are now editable in both variants.

Why

The builder doesn't support slack_file (no upload flow, and the preview can't render workspace files), so an image block loaded from an existing message with a slack_file backing was completely stuck — the flyout showed "Not editable in the visual builder" with no way to switch it to a URL-backed image.

Implementation notes:

  • Slack rejects an image block carrying both image_url and slack_file (verified against @tightknitai/slack-block-kit-validator), so the source switch swaps one backing field for the other. The replaced default is spread first so a malformed block that already carries both keys keeps its existing value.
  • Switching to Public URL intentionally starts from an empty image_url: the flyout's validation error nudges the user to paste a real URL rather than silently sending a placeholder image.
  • Within slack_file, Slack accepts {id} or {url} (not both), so editing one field rewrites the reference and clears the other.
  • The radio option is labeled "Public URL" (not "Image URL") so it doesn't collide with the Image URL input's accessible label.
  • The new SwitchingImageSourceProducesValidBlock story overrides the meta useArgs render with local state: updateArgs deep-merges args, and a merge can't express removing the slack_file key.

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test — 513 passed (44 files), including 8 new unit tests in test/image-editor.test.tsx and 2 new stories (a static slack_file editor story and a browser play test converting slack_file → URL end-to-end)
  • pnpm build and pnpm build-storybook

Generated by Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…rces

A slack_file-backed image block used to render a single "not editable"
message in the editor flyout, with no way out — you couldn't convert it
to the image_url variant the builder does support. Add an "Image source"
radio (Public URL / Slack file) that swaps one backing field for the
other (Slack rejects a block carrying both), plus editable File ID /
File URL fields for the slack_file reference itself. Alt text and title
now stay editable in both variants.

Switching to Public URL starts from an empty image_url on purpose: the
flyout's validation error nudges the user to paste a real URL instead of
silently sending a placeholder.

The new story overrides the meta useArgs render because updateArgs
deep-merges args — a merge can't express removing the slack_file key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EWnoaAY6K3zJVW16TtduX3
@StephenTangCook
StephenTangCook merged commit b86581e into main Aug 17, 2026
9 of 10 checks passed
@StephenTangCook
StephenTangCook deleted the claude/image-block-slack-file-control-vp9egt branch August 17, 2026 14:45
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