soccerloway/quill-better-table

Pasting plain text also changes to table format

freesia-jzy opened this issue · 10 comments

If I paste a copy of my notes on it, or if I paste a block of code on it, it's going to be in table format, but I don't want it in table format.

Pasting html into the quill editor will go through a convert process, which will match the html elements in the clipboard to the blots defined in quill. Because the line in the cell of quill-better-table uses div tags, the div tags pasted from the clipboard are converted into tableCellLine, which causes the situation you encounter.

Code blocks are usually wrapped in code tags, and paragraphs are wrapped in p tags. However, I do have some unreasonable use of div tags, but this is to distinguish it from the text in quill.

Well, I understand why, but is there any way to avoid it? Because most of the user's paste is in text format.😢

Maybe you can handle the delta of the div tag by add a new matcher. Change the pasted div to normal text.
Quill Docs for adding customize matcher

Since I made a low-level mistake at the beginning, I wrote TableCellName.className as TableCellName.ClassName, it led me to finally use DIV to implement TableCellLine. So pasting DIV tag will be treated as tableCellLine. I changed DIV to P. This issue was fixed now.

Hello @soccerloway,

the change you mentioned in the README of 1.2.0 (353fa78) unfortunately doesn't work. You can see a live demo here.

Here's a preview:

Screen Capture on 2020-07-02 at 07-31-28

I've updated the version in the CodePen to the latest:

image

Thanks for your help.

Hi @natterstefan , thanks for your report.
The updates are used to fix that DIV will be converted to TableCellLine while users copy DIV tags and paste into quill editor.
Not the issue pasting multi lines text into table cell will break table, pasting multi lines text into table cell is still exist.

I thinks your above report is about issue #33 .

Not the issue pasting multi lines text into table cell will break table, pasting multi lines text into table cell is still exist.

Hi,

thanks for the feedback. 🤔 this also happens to me when pasting formatted text (e.g. the text in the example is bold), not just with multi-line texts.

Hello, has this been resolved? I have the same problem :)