Skip to content

Allow hiding the built-in "Format" and "Copy as Markdown" options in the text input's selection menu #407

Description

@sgrvl

Is your feature request related to a problem? Please describe.
EnrichedMarkdownTextInput's text-selection menu always shows a fixed Format submenu and a Copy as Markdown action, with no way to hide any of them. We only use a subset of these styles and don't need to let users Copy as Markdown.

Localization makes it worse: we ship in many languages, but these items are English-only with no way to override the labels. Hiding the ones we don't use helps on both fronts, and for the ones we keep, being able to supply our own localized labels would let them match the rest of our UI.

The read-only components (EnrichedMarkdownText / EnrichedMarkdown) already got a selectionMenuConfig prop to hide built-in selection-menu actions (#272#285), but it was never wired to the editable input.

Describe the solution you'd like
Add a selectionMenuConfig prop to EnrichedMarkdownTextInput, mirroring the one already on the read-only components (#285). It should be default-on and backward compatible: omitting it (or any field) reproduces today's exact menu.

At minimum, a coarse on/off for the two built-ins, hiding the whole Format submenu and/or the Copy as Markdown action:

<EnrichedMarkdownTextInput
  selectionMenuConfig={{ format: false, copyAsMarkdown: false }}
/>

Two refinements would be valuable on top of that:

  • Per-item format control: rather than all-or-nothing on the Format submenu, let us choose which individual items appear, so we can drop just Spoiler while keeping Bold / Italic / Underline / Strikethrough / Link. Widening format from a plain boolean to boolean | Partial<Record<FormatStyle, boolean>> covers both cases, with format: false still meaning "hide everything".

  • Custom labels: let us supply our own string for each built-in item, so the menu can be localized to match the rest of our app instead of showing the English labels only.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions