Draft: Fix multi-cell copy/paste in rich text editor tables

What does this MR do and why?

Fix multi-cell copy/paste functionality in GitLab's rich text editor tables.

When copying multiple table cells and pasting into a table in the rich text editor, the content was being pasted as markdown into a single cell instead of being distributed across the appropriate cells.

Root cause: The copyPaste extension (with EXTENSION_PRIORITY_HIGHEST) intercepted all paste events before the prosemirror-tables handlePaste could run. The prosemirror-tables handlePaste correctly distributes pasted cells across rows and columns and auto-expands the table when needed.

Fix: When the user is pasting inside a table and the clipboard contains HTML with table cells, the paste event is delegated to prosemirror-tables' handlePaste, which handles:

  • Distributing cell content across the correct rows and columns
  • Auto-expanding the table when pasting more cells than existing columns

References

Closes #585267 (closed)

Screenshots or screen recordings

Before After
Pasting multiple cells inserts all content as markdown into a single cell Pasting multiple cells distributes content across the correct cells, auto-expanding the table if needed

How to set up and validate locally

  1. Open the rich text editor (e.g., in a Wiki page or issue description)
  2. Create a table with multiple rows and columns
  3. Select multiple cells (e.g., a column of values)
  4. Copy the selection (Cmd/Ctrl+C)
  5. Click on a cell in another table (or the same table)
  6. Paste (Cmd/Ctrl+V)
  7. Verify that the pasted content is distributed across the correct cells instead of being inserted as markdown into a single cell

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading