mdx-editor / mdx-editor/editor

[BUG] Copy-pasting tables into table cells is still possible and produces messed-up markdown.

Open
#784 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
307
Avg merge
14h 22m
Merged PRs (30d)
5

Description

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have read the documentation and cannot find an answer.

Describe the bug

Copy-pasting tables into table cells is still possible and produces messed-up markdown.

To Reproduce

  1. Go to https://mdxeditor.dev/editor/demo
  2. Insert a table
  3. Copy some content from an other page containing a table, or a table from Excel (with Ctrl+C)
  4. Put the cursor inside one table cell in the markdown editor
  5. Paste the content (Ctrl+V)
  6. Check the markdown (source) view and observe the broken syntax

Expected behavior

There are different ways how this could work

  1. The table is cut out from the pasted content so only the non-table part is pasted.
  2. The pasted content still contains the table but is pasted after the originally targeted table
  3. A separate HTML extension is installed where it uses html tables instead of the GFM table syntax, which supports table nesting (but I imagine it is significantly more tedious to do than the others).

Screenshots

Image

Desktop (please complete the following information):

  • OS: [e.g. MacOS, Windows] - MacOS
  • Browser: Chrome, Firefox

Additional context

Please do not disable table copy-pasting in general to fix this, copy-pasting tables from excel or html is a fantastic feature.

I have found this related issue which was fixed by disabling the table button: https://github.com/mdx-editor/editor/issues/686

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the editor demo and reproduce the paste sequence with a copied HTML or Excel table, then inspect the markdown source view for the malformed table syntax. The issue lists several possible behaviors but does not choose one, so confirm the intended outcome before changing paste handling; done means table pasting no longer creates broken nested markdown while table pasting remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, react, typescript
Domain
content, frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.