mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-21 03:03:15 +08:00
## Summary Closes #13954 The "Turn into" menu was missing the Callout option. Users had no way to convert an existing paragraph/list/code block into a Callout directly from the slash menu or context toolbar. ## Root Cause `textConversionConfigs` in `rich-text/src/conversion.ts` had no entry for `affine:callout`, so the option never appeared in the menu. Additionally, Callout is a **hub block** — its text lives in a child paragraph, not in its own `text` prop. This means the generic `transformModel` path would silently fail, requiring a dedicated conversion handler. ## Changes - `blocksuite/affine/rich-text/src/conversion.ts` — add callout entry to `textConversionConfigs` - `blocksuite/affine/blocks/note/src/commands/block-type.ts` — add `transformToCallout` command that: 1. Creates a new `affine:callout` block at the original position 2. Moves the original text into a child `affine:paragraph` inside the callout 3. Deletes the original block ## Before / After | Before | After | |--------|-------| | "Turn into" menu had no Callout option | Callout appears in "Turn into" menu | | Selecting any block → Turn into showed: Heading, Text, Quote, Divider… | Now also shows: **Callout** | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Convert selected paragraphs, lists, and code blocks into callouts while preserving text and nested content. * Added callout recognition and icon display in rich-text conversion. * Conversion results now distinguish between selected blocks and text. * **Bug Fixes** * Prevented invalid, nested, or incompatible callout conversions. * The conversion menu now hides Callout when unavailable. * Preserved original blocks when conversion fails. * Improved undo and redo behavior for callout conversions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DarkSky <darksky2048@gmail.com>