quill-better-table icon indicating copy to clipboard operation
quill-better-table copied to clipboard

Pasting plain text also changes to table format

Open freesia-jzy opened this issue 4 years ago • 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.

freesia-jzy avatar Apr 26 '20 07:04 freesia-jzy

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.

soccerloway avatar Apr 28 '20 02:04 soccerloway

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.

soccerloway avatar Apr 28 '20 02:04 soccerloway

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

freesia-jzy avatar Apr 28 '20 03:04 freesia-jzy

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

soccerloway avatar Apr 28 '20 08:04 soccerloway

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.

soccerloway avatar Jun 30 '20 16:06 soccerloway

Hello @soccerloway,

the change you mentioned in the README of 1.2.0 (https://github.com/soccerloway/quill-better-table/commit/353fa78add00b03c7977aac7e582b29b92cb32be) 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.

natterstefan avatar Jul 02 '20 05:07 natterstefan

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.

soccerloway avatar Jul 02 '20 06:07 soccerloway

I thinks your above report is about issue #33 .

soccerloway avatar Jul 02 '20 06:07 soccerloway

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.

natterstefan avatar Jul 02 '20 07:07 natterstefan

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

Huseyin-altun avatar Jan 24 '24 05:01 Huseyin-altun