Hosted onhoraciohdev.dev.hyper.mediavia theHypermedia Protocol

[DONE] Disable insert controls in image captionshttps://github.com/seed-hypermedia/seed/pull/626


Description
As an Author, I want to add a caption to an image so I can give Readers more context.

Acceptance Criteria

    Image captions do not show the Insert Block button.

    The slash menu is disabled inside image captions.

    Image captions only allow inline rich text only and not blocks.


Testing

Recap

Implemented the image-caption restriction so captions remain inline rich text only and no longer expose block-insertion UI or slash commands.

Files touched

    frontend/packages/editor/src/inline-add-block-button.tsx

    frontend/packages/editor/src/blocknote/core/extensions/SlashMenu/SlashMenuPlugin.ts

    frontend/packages/editor/src/blocknote/core/shared/plugins/suggestion/SuggestionPlugin.ts

    frontend/packages/editor/src/inline-add-block-button.test.tsx

    frontend/packages/editor/src/blocknote/core/__tests__/slash-menu-caption-guards.test.ts

Main objects changed

    InlineAddBlockButton

      Added a guard so the floating Insert Block button does not render when selection is inside an image caption.

    isSlashMenuEnabled

      Added as a shared helper in SlashMenuPlugin.ts to centralize whether slash commands are allowed in the current selection context.

    SlashMenuProsemirrorPlugin

      Wired the new guard into slash-menu activation so / does not open the menu inside image captions.

    setupSuggestionsMenu

      Extended with an optional isEnabled context guard.

      Prevents activation in blocked contexts and closes the menu if selection moves into one.

Behavior delivered

    Image captions do not show the Insert Block button.

    The slash menu is disabled inside image captions.

    Captions stay inline rich text only; no schema rewrite was introduced.

Tests added

    inline-add-block-button.test.tsx

      Verifies the button appears in a normal empty paragraph.

      Verifies the button is hidden inside an image caption.

    slash-menu-caption-guards.test.ts

      Verifies slash menu works in normal paragraphs.

      Verifies slash menu is blocked inside image captions.

      Verifies an active slash menu closes when selection moves into a caption.

Notes

    No schema/content-model change was made.

    Existing plain-text caption behavior was preserved.

    Full local validation was blocked in this environment because frontend dependencies were not installed.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime