Skip to content

fix: paste th should as a line like td #4614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zzxming
Copy link

@zzxming zzxming commented Feb 26, 2025

Description

when there are consecutive 'th' in the pasted table, the pasted 'th' will be merged.

I checked the source code and found that 'th' was not parsed as a line like 'td', so this situation occurred

Reproduction

paste the table below

paste html
<table>
  <tbody>
    <tr>
      <th scope="col">Person</th>
      <th scope="col">Most interest in</th>
      <th scope="col">Age</th>
    </tr>
    <tr>
      <th scope="row">Dennis</th>
      <td>Web accessibility</td>
      <td>45</td>
    </tr>
    <tr>
      <th scope="row">Sarah</th>
      <td>JavaScript frameworks</td>
      <td>29</td>
    </tr>
  </tbody>
</table>

Current Behavior

image

and the table delta like this

[
    {
        "insert": "PersonMost interest inAge\n",
        "attributes": {
            "table": 1
        }
    },
    {
        "insert": "Dennis\nWeb accessibility\n45\n",
        "attributes": {
            "table": 2
        }
    },
    {
        "insert": "Sarah\nJavaScript frameworks\n29\n",
        "attributes": {
            "table": 3
        }
    }
]

Expected Behavior

image

the correct table delta should be like this

[
    {
        "insert": "Person\nMost interest in\nAge\n",
        "attributes": {
            "table": 1
        }
    },
    {
        "insert": "Dennis\nWeb accessibility\n45\n",
        "attributes": {
            "table": 2
        }
    },
    {
        "insert": "Sarah\nJavaScript frameworks\n29\n",
        "attributes": {
            "table": 3
        }
    }
]

Additional comments

I have my own quill table module plugin that provides many table related operations. but I found this issue when I paste th tag into editor. there is a lot of code related to 'isLine' that has not been exposed to the outside, so I am unable to hack it.

work-2025 pushed a commit to work-2025/quill that referenced this pull request Apr 3, 2025
work-2025 pushed a commit to work-2025/quill that referenced this pull request Apr 3, 2025
work-2025 pushed a commit to work-2025/quill that referenced this pull request May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant