Skip to content

Option to disable long-press copy menu on code blocks and tables #685

Description

@ejjays

On Android, selectable={true} on EnrichedMarkdownText makes regular text selectable (native text-selection menu on longpress), but CodeBlockContainerView.kt and TableContainerView.kt hardcode setOnLongClickListener { ... showContextMenu(...) }, which opens the library's custom popup (copy code / copy as markdown, or copy table) instead of the native menu. Code blocks also already expose a copy button in the header (copyButton), so for those the longpress popup is redundant with the builtl in copy affordance.

There's no way to disable the popup or fall back to the native selection menu. The selectable prop only affects regular text segments.

Would be useful to turn this off per instance.. e.g. a prop on EnrichedMarkdownText or a flag in the style object.

Working around it locally with patch-package (stripping the listeners) for now. Happy to open a PR if a prop is the right direction.

Additional notes:

  • Math blocks follow the same pattern — isMathContainerView also receives setCopyLabel/copyAsMarkdownLabel and shows the same popup, so a fix should cover tables, code blocks, and math.
  • selectionMenuConfig labels already apply to the table and math block copy menus, so extending enabled: false on its items to hide the whole block popup might be the least new API path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions