soccerloway / quill-better-table

Module for better table in Quill, more useful features are supported.
MIT License
313 stars 120 forks source link

Pasting plain text also changes to table format #50

Open freesia-jzy opened 4 years ago

freesia-jzy commented 4 years ago

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.

soccerloway commented 4 years ago

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 commented 4 years ago

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.

freesia-jzy commented 4 years ago

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

soccerloway commented 4 years ago

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 commented 4 years ago

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.

natterstefan commented 4 years ago

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.

soccerloway commented 4 years ago

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 commented 4 years ago

I thinks your above report is about issue #33 .

natterstefan commented 4 years ago

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.

Huseyin-altun commented 7 months ago

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